Retrieve all folder & sub folder from document library in sharePoint 2013
Hi,
I want to retrieve all the folder and sub folder from document library and bind it to the dropdownlist using server object model.
I used the below query to get all folder and sub folder.\
query.Query = @"<Query><Where><Eq><FieldRef
Name='FSObjType' /><Value Type='Lookup'>1</Value></Eq></Where></Query>";
query.ViewAttributes
="Scope='RecursiveAll'";
query.ViewFields
= "<FieldRef Name='Title'/>";
query.ViewFieldsOnly
= true;
but when I bind result with the dropdownlist,it displays the output as below
Please Help
Thank You
Hi,
Thanks for posting your issue, Kindly try out below mentioned CAML query to get all the Folders and Subfolders from Document Library
<Query>
<Where>
<Contains>
<FieldRef Name='FileLeafRef' />
<Value Type='Text'>token</Value>
</Contains>
</Where>
<OrderBy><FieldRef Name='FileDirRef' /></OrderBy>
</Query>
<ViewFields>
<FieldRef Name='ID' />
<FieldRef Name='LinkFilename' />
<FieldRef Name='FileDirRef' />
<FieldRef Name='FileLeafRef' />
</ViewFields>
<QueryOptions>
<ViewAttributes Scope='Recursive' />
<OptimizeFor>FolderUrls</OptimizeFor>
</QueryOptions>
Also, check out below mentioned URLs to fix this issue
https://social.msdn.microsoft.com/Forums/office/en-US/35e799a1-9360-46e5-8719-dd35fdace7ea/filter-document-library-folder-through-caml-query?forum=sharepointdevelopmentlegacy
http://www.ktskumar.com/blog/2009/07/retrieve-all-folders-from-list/
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh
Similar Messages
-
Get/retreive managed metadata column value from Document Library using SharePoint 2013 JSOM
Hi,
I am trying to retrieve managed metadata column (NewsCategory) value in SharePoint 2013 Document library using JSOM.
I get "Object Object" rather than actual value.
I tried:-
var newsCat = item.get_item('NewsCategory');
alert(newsCat) //Displays [Object Object]
var newsCatLabel = newsCat.get_label();
var newsCatId = newsCat.get_termGuid();
But, I get the error "Object doesn't support property or method get_label()"
I also tried :-
var newsTags = item.get_item(' NewsCategory ');
for (var i = 0; i < newsTags.get_count() ; i++) {
var newsTag = newsTags.getItemAtIndex(i);
var newsTagLabel = newsTag.get_label();
var newsTagId = newsTag.get_termGuid();
Even now I get the error "Object doesn't support property or method get_count()"
I have included " NewsCategory " in the load request:- context.load(items, 'Include(File, NewsCategory)');
Any idea what the issue is? Do I have to add any *.js file using $.getScript?
I added following .js files
var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
$.getScript(scriptbase + "SP.Runtime.js", function () {
$.getScript(scriptbase + "SP.js", function () {
$.getScript(scriptbase + "SP.Core.js", function () {
Thanks in Advance,Hi Patrick,
I already added those references. I just pasted the parts of script snippet in my initial post. To avoid confusion I am pasting here complete script.
2.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
$.getScript(scriptbase + "SP.Runtime.js", function () {
$.getScript(scriptbase + "SP.js", function () {
$.getScript(scriptbase + "SP.Core.js", function () {
function getdata() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Documents');
var camlQuery = new SP.CamlQuery();
var filterCategory = 'Solutions';
var IDfromTaxonomyHiddenList = 15;
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef LookupId="TRUE" Name="'+filterCategory+'" /><Value Type="ID">' + IDfromTaxonomyHiddenList +'</Value></Eq></Where></Query></View>');
/*the above CAML query successfully gets all the list items matching the criteria including "NewsCategory" managed metadata column values
But when I try to display the value it retrieved it ouputs/emits Object Object rather than actual values */
var items = list.getItems(camlQuery);
context.load(items, 'Include(File,NewsCategory)');
context.executeQueryAsync(
Function.createDelegate(this, function (sender, args) {
if (items.get_count() > 0) {
var listItemEnumerator = items.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
var file = oListItem.get_file();
var name = file.get_name();
var newsCat = oListItem.get_item('NewsCategory'); alert(newsTags.constructor.getName());
alert(newsCat) //Displays [Object Object]
var newsCatLabel = newsCat.get_label(); // Here it errors out with message "Object doesn't support property or method get_label()"
var newsCatId = newsCat.get_termGuid();
} //end while
}//end if
Function.createDelegate(this, function (sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
ExecuteOrDelayUntilScriptLoaded(getdata, "SP.Core.js");
</script>
In the above script "var name = file.get_name(); " gets the exact file name.
But the line "var newsCat = item.get_item('NewsCategory');
alert(newsCat) //Displays [Object Object] rather than actual value.
Issue resolved replace "oListItem.get_item('NewsCategory');" with oListItem.get_item('NewsCategory').get_label();"
Thanks -
ID in Document library in SharePoint 2013
Hi,
I have an document library in SharePoint 2013.I uploaded some documents to document library for testing.Now I deleted these testing documents.And when user starts adding documents,the id of the document is not started from 1.
So how I will get the id starting from 1.
Any help?
Thank you.Save the list as a template and recreate the list usign this template. ID columns will always keep incrementing
and will never be reused. -
I have an Access 2013 Web App in my Sharepoint 2013 online website. It contains a query to report on its data (several, actually, but let's keep it simple). I want to connect an Excel spreadsheet to the query, visualise the data in pivot tables/graphs/whatever,
save the spreadsheet in a Document Library, and let other team site Sharepoint users open the spreadsheet (preferably in Excel online, but with Excel client if it has to be) and see/copy the data, refreshed with the latest information from the Access Web App.
Simple, surely!
The way I'm doing it at the moment is to create an ODC file to connect to the cloud-based Access 2013 database, save that ODC in a Data Connection Library in the SP site, and use the saved ODC file as data source in the Excel spreadsheet. This works and
successfully keeps everything 'in the cloud' but I can't get it to refresh in Excel Online, and if I open the spreadsheet in Excel Client I have to enter the database password every time to refresh it. I don't really want to issue this password to everyone
who might want to view the data. There must be a better way than this ODC method, I suspect.
Googlings on this have led down various blind alleys - Excel Services, PowerPivots, Web Parts - but I'm stuck on which to follow through. Please, someone, point me to an article/book/website that explains how to do this step-by-step in simple language..
thanks
JonathanI don't see any quick way of achieving it - at least there's no such functionality exists in SharePoint. All you can do, develop an event receiver that will update the fields in the list item once the excel file is added/updated. You can use OpenXml API
to manipulate the excel file.
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com -
Set unique file name for document library in SharePoint 2013
Hi,
I have document library in the sharepoint 2013 with two dropdown fields-dept name,dept id.
My requirement is to create a namiing convention for each file uploded in the document library.
So the naming convention should be "deptname-deptid-filename-Id".
I tried this naming convention using workflow as below-
In this case ,first I attach the file and then it asks for dept name & id,Whwn i input these value,it shows error message as this file is modified by you at this point of time.On cancel it saves the attached file but does not save the deptname and dept
id.
please help if any idea or suggestion.
Thank you.The only way I've ever seen this work while adding a new file is to use an Event Reciever. Build an Event
Receiver that fires whenever a file is added and have the code change the name of the file from whatever the user titled it to the naming convention you are using.
Paul Stork SharePoint Server MVP
Principal Architect: Blue Chip Consulting Group
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
How to apply masterpage for document library in SharePoint 2013
Hi,
is it possible to change the master page in library level.DO you mean JUST at the library level? If so, there's no way that I know of as Master Pages are applied to Sites at a whole. They then have Page Layouts added, which tell SharePoint where to load the content, which is where your document library
would be.
What do you hoping to achieve?
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
Hi Team,
I am trying to move the .pdf files from drop-off library to custom library.
For the above requirement i am writing content organizer rule condition like (On Group: Document content types & Type: Document)
Property: Name
Operator: Ends with
value: .pdf
and Setting value in target location like
/sites/MS/ProductGuides
How to solve the issue
If help appriciated
Regards,
DhayaHi Dhaya,
I created a Content Organizer rule like this:
When uploading a .pdf file to the Drop Off library, it is moved to the destination library immediately:
I suggest you create a similar rule as above for another test to see if the issue still persists.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Creating a folder for a document library in SharePoint online
Hello I am looking for a good place to get started on creating a folder for a document library using a powershell script. Thanks in advance for any help.
Here is a guide to creating folders and items in a document library for SharePoint Server/Foundation: Creating SharePoint Folders
and Items with PowerShell. You will need to tailor it to your needs as it's a demo for creating 50,000 items.
That's step 1 and contains the bulk of what you would need to do. Here's an example of connecting to a library in SharePoint Online using CSOM: Office
365 - PowerShell Script to Upload Files to a Document Library using CSOM. You won't be uploading files, but the parts where you connect and get a list are what you're interested in.
Now you'll combine bits from both of these scripts:
1. Connect to SPO
2. Get your list (looks like you need to first get the site collection and then the site)
3. Create a folder
I figure it would look something like this (note I haven't tested this at all):
#Specify tenant admin and site URL
$User = "[email protected]"
$SiteURL = "https://tenant.sharepoint.com/sites/site"
$DocLibName = "DocLib"$FolderTitle = "Example Folder"
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString
#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
#Retrieve list
$List = $Context.Web.Lists.GetByTitle($DocLibName)
$folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder)
$folder["Title"] = $FolderTitle
$folder.Update();
Jason Warren
@jaspnwarren
jasonwarren.ca
habaneroconsulting.com/Insights -
Creating a Folder Within Form or Document Library & Display the name not in the name column.
I have created a form library that will used to create folders within that. The folder creation is done using an InfoPath Form that has been uploaded to the Form Library. When the new folder was created the name will be displayed at the Name column within
the Form Library. I want to change that to another column like documents or suchlike.
Can it be done using InfoPath 2010 VSTA C# or not? If their are other options available please could you try to inform me!
Thank You,
ChiranthakaHi,
If you want to show the name of folder in another column, a workaround is that you can create an extra column, then create a SharePoint Designer workflow to set the value of
this column with the name of folder.
Here is a link about Create Workflow using SharePoint Designer and set field value for your reference:
http://www.codeproject.com/Tips/419037/Create-Workflow-using-SharePoint-Designer
I have seen a similar post from you in the link below:
http://social.technet.microsoft.com/Forums/en-US/c3ff3f17-dbe2-40f9-86c5-ff7d4b663f09/creating-a-folder-within-form-or-document-library-display-the-name-not-in-the-name-column?forum=sharepointcustomizationprevious
It's recommended that you post a single question in a single thread which will make it easier to be discussed by others.
Best regards
Patrick Liang
TechNet Community Support -
How to loop folder , sub folder and files in the sql server ?
Hi,
I have a folder , sub folder and files like this.
Here AuditSearchHistory fixed folder and contains 2 subfolders , but some times it may contain more sub folders also.
Please help me to loop the subfolders to get xls files in the sql without SSIS , Because I need to get just xls file paths.
Thank you.Please run these Macros in Excel.
Sub TestListFilesInFolder()
' Open folder selection
' Open folder selection
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select a Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo NextCode
pPath = .SelectedItems(1)
If Right(pPath, 1) <> "\" Then
pPath = pPath & "\"
End If
End With
NextCode: 'MsgBox "No files Selected!!"
'Application.WindowState = xlMinimized
'Application.ScreenUpdating = False
Workbooks.Add ' create a new workbook for the file list
' add headers
ActiveSheet.Name = "ListOfFiles"
With Range("A2")
.Formula = "Folder contents:"
.Font.Bold = True
.Font.Size = 12
End With
Range("A3").Formula = "File Name:"
Range("B3").Formula = "File Size:"
Range("C3").Formula = "File Type:"
Range("D3").Formula = "Date Created:"
Range("E3").Formula = "Date Last Accessed:"
Range("F3").Formula = "Date Last Modified:"
Range("A3:F3").Font.Bold = True
Worksheets("ListOfFiles").Range("A1").Value = pPath
Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
ListFilesInFolder Worksheets("ListOfFiles").Range("A1").Value, True
' list all files included subfolders
Range("A3").Select
Lastrow = Range("A1048576").End(xlUp).Row
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("ListOfFiles").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("ListOfFiles").Sort.SortFields.Add Key:=Range( _
"B4:B" & Lastrow), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("ListOfFiles").Sort
.SetRange Range("A3:F" & Lastrow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
Cells.Select
Cells.EntireColumn.AutoFit
Columns("A:A").Select
Selection.ColumnWidth = 100
Range("A1").Select
End Sub
Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders As Boolean)
' lists information about the files in SourceFolder
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
r = Range("A1048576").End(xlUp).Row + 1
For Each FileItem In SourceFolder.Files
' display file properties
Cells(r, 1).Formula = FileItem.Path & FileItem.Name
Cells(r, 2).Formula = (FileItem.Size / 1048576)
Cells(r, 2).Value = Format(Cells(r, 2).Value, "##.##") & " MB"
Cells(r, 3).Formula = FileItem.Type
Cells(r, 4).Formula = FileItem.DateCreated
Cells(r, 5).Formula = FileItem.DateLastAccessed
Cells(r, 6).Formula = FileItem.DateLastModified
' use file methods (not proper in this example)
r = r + 1 ' next row number
Next FileItem
If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFilesInFolder SubFolder.Path, True
Next SubFolder
End If
Columns("A:F").AutoFit
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
ActiveWorkbook.Saved = True
End Sub
Or . . .
Option Explicit
Sub CreateList()
Application.ScreenUpdating = False
Workbooks.Add ' create a new workbook for the folder list
' add headers
ActiveSheet.Name = "ListOfFiles"
With Cells(3, 1)
.Value = "Folder contents:"
.Font.Bold = True
.Font.Size = 12
End With
Cells(4, 1).Value = "Folder Path:"
Cells(4, 2).Value = "Folder Name:"
Cells(4, 3).Value = "Folder Size:"
Cells(4, 4).Value = "# Subfolders:"
Cells(4, 5).Value = "# Files:"
Range("A3:E3").Font.Bold = True
ListFolders BrowseFolder, True
Application.ScreenUpdating = True
Cells.Select
Cells.EntireColumn.AutoFit
Columns("A:A").Select
Selection.ColumnWidth = 100
Columns("B:B").Select
Selection.ColumnWidth = 25
Range("A1").Select
End Sub
Sub ListFolders(SourceFolderName As String, IncludeSubfolders As Boolean)
' lists information about the folders in SourceFolder
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
' display folder properties
Worksheets("ListOfFiles").Range("A1").Value = SourceFolderName
Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
r = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(r, 1).Value = SourceFolder.Path
Cells(r, 2).Value = SourceFolder.Name
Cells(r, 3).Value = SourceFolder.Size
Cells(r, 3).Value = (SourceFolder.Size / 1048576)
Cells(r, 3).Value = Format(Cells(r, 3).Value, "##.##") & " MB"
Cells(r, 4).Value = SourceFolder.SubFolders.Count
Cells(r, 5).Value = SourceFolder.Files.Count
If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFolders SubFolder.Path, True
Next SubFolder
Set SubFolder = Nothing
End If
Columns("A:E").AutoFit
Set SourceFolder = Nothing
Set FSO = Nothing
ActiveWorkbook.Saved = True
End Sub
Or . . .
Const BIF_RETURNONLYFSDIRS As Long = &H1 ''' For finding a folder to start document searching
Const BIF_DONTGOBELOWDOMAIN As Long = &H2 ''' Does not include network folders below the domain level in the tree view control
Const BIF_RETURNFSANCESTORS As Long = &H8 ''' Returns only file system ancestors.
Const BIF_BROWSEFORCOMPUTER As Long = &H1000 ''' Returns only computers.
Const BIF_BROWSEFORPRINTER As Long = &H2000 ''' Returns only printers.
Const BIF_BROWSEINCLUDEFILES As Long = &H4000 ''' Returns everything.
Const MAX_PATH As Long = 260
Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszINSTRUCTIONS As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Declare Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As Long, ByVal pszBuffer As String) As Long
Declare Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As BROWSEINFO) As Long
Function BrowseFolder() As String
Const szINSTRUCTIONS As String = "Choose the folder to use for this operation." & vbNullChar
Dim uBrowseInfo As BROWSEINFO
Dim szBuffer As String
Dim lID As Long
Dim lRet As Long
With uBrowseInfo
.hOwner = 0
.pidlRoot = 0
.pszDisplayName = String$(MAX_PATH, vbNullChar)
.lpszINSTRUCTIONS = szINSTRUCTIONS
.ulFlags = BIF_RETURNONLYFSDIRS
.lpfn = 0
End With
szBuffer = String$(MAX_PATH, vbNullChar)
''' Show the browse dialog.
lID = SHBrowseForFolderA(uBrowseInfo)
If lID Then
''' Retrieve the path string.
lRet = SHGetPathFromIDListA(lID, szBuffer)
If lRet Then BrowseFolder = Left$(szBuffer, InStr(szBuffer, vbNullChar) - 1)
End If
BrowseFolder = BrowseFolder & "\"
End Function
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
HI
I created a web application and configured rbs storage ,
I uploaded documents (for ex: 18 number)
after uploaded documents , and observed the RBS storage folder, number of files are increasing (39 number) , its working fine
and also I run the querys to check the rows increasing or not , (when I upload new doc rows are increased its fine also)
select count(*) from alldocs
Select count(*) from AllDocstreams
but when I delete some docs from document library ,
1)the doc itself deleted from document library
2)when I check the rbs storage there is no number of files are decreased(its still 39 files ), its same as before doc deleted from doc library
after some time I found the number of files are decreasing from RBS storage folder in sql server,
here I want to know the how the files are decreasing from RBS storage after some time, where shld I check the settings for this? and how I control on it
here how I know the settings for cleaning up orphan BLBOS how these deleted BLOB
adil1. WHen you delete the file from Sharepoint, it is still present in Recycle bin. This is a default setting in sharepoint for 30 days. Once files are deleted fro Recycle bin, it can also be delete from RBS
2. There is a RBS cleanup job which deletes files from RBS. for more info check
http://mehuljamod.blogspot.in/2012/09/remote-blob-storage-maintainer-rbs.html -
Download files from document library in zip file using javascript
Hi,
I am developing SharePoint Hosted App which needs to download all the files in the document libraries of SharePoint site in a zip folder where in that zip file each document library should be a folder, in that folder the files of that document library will
be shown. Currently I am display all the document library in a table with check boxes as shown in the below figure. Now when user selects the check boxes and click on download button, the selected document libraries along with the files should be downloaded
in a zip folder. This should be achieved through javascript. Can anyone share me the code to solve this problem.
Thanks & Regards,
Kishore
KishoreYou can use
zip.js, but the best way - implement your solution on the server-side.
[custom.development] -
New photo app does not import all of my photos from iphoto library
I have just installed 10.10.3 on my Macbook and the new photo app does not import all of my photos from iphoto library. I have about 3200 photos in the library and only 2300 are presented for import. I only have 1 library so I didn't choose the wrong one. Any suggestions?
Upon closer inspection it appears that the missing photos are in a folder called IPhoto Library. This folder is greyed out when I choose the import folder.
When I use 'show package contents' it reveals the missing photos (below). Why is my iphoto library so scrambled! Thanks for any insight. -
Drag and drop the file from document library to desktop in sharepoint 2013
can we drag and drp the file from document library to desktop in sharepoint 2013
BlitzWe are using third party tool called PageLight for
SharePoint Outlook Integration which provides drag and drop functionality of emails from Outlook to SharePoint. Other features includes
Save Outlook emails to SharePoint and also moving files/folders from file share.
Thanks
Alfred -
PowerShell script to find and remove duplicate items from document library
Hi Friends,
Please check this below script, It is finding the duplicate items and removing it. This script is not working to find the duplicate items from document
library and remove. Can you please let me know where it is wrong.
Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb -Identity "http://zapltvsspdev02:4333/bu/EXCO"
$list = $web.Lists["AECI Documents"]
$AllDuplicates = $list.Items.GetDataTable() | Group-Object INumber | where {$_.count -gt 1}
$count = 1
$max = $AllDuplicates.Count
foreach($duplicate in $AllDuplicates)
$duplicate.group | Select-Object -Skip 1 | % {$list.GetItemById($_.ID).Delete()}
Write-Progress -PercentComplete ($count / $max * 100) -Activity "$count duplicates removed" -Status "In Progress"
$count++
Remove-PsSnapin Microsoft.SharePoint.PowerShell
Note:
In the above code, duplicates are found using the "INumber" column.
valmikicheck this
http://stackoverflow.com/questions/21337158/delete-duplicate-items-in-sharepoint-list
Maybe you are looking for
-
Error while debugging AIR for IOS app
I get the following error when attempting to debug my AIR-IOS app on an IPad 2. The weird thing is that the logfile mentioned does not exist. Any ideas? - Abey # A fatal error has been detected by the Java Runtime Environment: # EXCEPTION_UNCAUGHT_C
-
i am buying a monitor for my macbook and was looking to spend aroung £130- £160 for sometihng ner a 20 inch screen, does anyone have any ideas whihc model woud be the best to buy,
-
Combine multiple animations/moving a motion tween path location
I have three similar animations that are stalling on preload as it's referencing the data from dropbox. We thought that it might be faster if it loaded only once, so I am now trying to combine the animations into a single scene. I'm having trouble co
-
Hey i need some help tiling a pdf on adobe reader. I have scanned a document that is 8.5in by 28in(out legal contract) but when i want to print it i can only print in landscape instead of portrait. i have played with all the setting and done everythi
-
Add Paper sign on when tray is full of paper
Printer will print a copy but not print anything from my laptop. When I try to print a Sign says "Add Paper" however the paper tray is full. Printer is A Photo Smart all in one express C3150 Thanks