Iterating through all Document Libraries, Folder and Item -Sharepoint 2010

Hi
I want to read all RootFolder,Subfolder along with all "items" from Document Librarie.
Can anyone please advise on this
Thanks

Use caml query with recursiveall which
will fetch all root folder and subfolder data from a document library.
for
your reference.
http://sharepoint.stackexchange.com/questions/29405/get-items-under-folder-caml
https://social.msdn.microsoft.com/Forums/office/en-US/6beba66a-adcc-4764-ba0d-ba7870d71457/recursive-caml-query?forum=sharepointdevelopmentprevious
camlQuery.ViewXml = "<View Scope=\"RecursiveAll\"> " +
"<Query>" +
"<Where>" +
"<Eq>" +
"<FieldRef Name=\"FileDirRef\" />" +
"<Value Type=\"Text\">/ecm/Business/Business/Projects/IDECO_P01030000</Value>" +
"</Eq>" +
"</Where>" +
"</Query>" +
"</View>";
Regards,
Rajendra Singh
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful http://sharepointundefind.wordpress.com/
Regards, Rajendra Singh If a post answers your question, please click Mark As Answer on that ost and Vote as Helpful http://sharepointundefind.wordpress.com/

Similar Messages

  • Uploading Multiple Documents To a List Item sharepoint 2010

    hi Guys ,
    Is there a way we can enable (out of the box )Uploading Multiple Documents To a List Item sharepoint 2010 ?
    cheers

    No, There is no OOB way to do the same you have to build a custom Page/Control OR customise OOB Form to attache multiple files and that will be through integration of ajax based control (multiple file uploader.)
    the other way to do the same is provision a custom field. we have done this for our many  clients.
    Hi, I also encountered the same problem, could u pls provide detailed information by a custom field?

  • Need help writing script to change version control for all document libraries in all sites

    Hello,
    I found this script, http://get-spscripts.com/2010/10/changing-sharepoint-list-settings-using.html that
    changes versions control for a document library.  However, many sites have many document libraries with different names.  The script below just changes a the settings to a document library that is named "Shared Documents", but does not
    change one if its named something else.  How can change the script to loop through all document libraries so their settings are changed?
    $site = Get-SPSite http://site
    $listName = "Shared Documents"
    #Walk through each site in the site collection
    $site | Get-SPWeb | 
    ForEach-Object {
    #Get the list in this site
    $list = $_.Lists[$listName]
    #Create a version each time you edit an item in this list (lists)
    #Create major versions (document libraries)
    $list.EnableVersioning = $true
    #Create major and minor (draft) versions (document libraries only)
    $list.EnableMinorVersions = $true
    #Keep the following number of versions (lists)
    #Keep the following number of major versions (document libraries)
    $list.MajorVersionLimit = 7
    #Keep drafts for the following number of approved versions (lists)
    #Keep drafts for the following number of major versions (document libraries)
    $list.MajorWithMinorVersionsLimit = 5
    #Update the list
    $list.Update()
    #Dispose of the site object
    $site.Dispose()
    Paul

    Sorry, I agree. It will update Style Library and other out of the box ones. Include the library titles in a collection and run the update against them provided these libraries are common across all sites. If not, you will have to first get an extract of
    all such libraries in all sites say in a CSV file and then update the script below to refer to the CSV records.
    Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction Stop;
    #List of Libraries to be updated.
    $Libraries = @("Shared Documents","My Document Library");
    $spAssgn = Start-SPAssignment;
    $site = Get-SPSite http://site -AssignmentCollection $spAssgn
    #Walk through each site in the site collection
    $site | Get-SPWeb -Limit ALL -AssignmentCollection $spAssgn |
    ForEach-Object {
    #Enumerate through all document libraries
    $_.Lists|Where{$_.BaseTemplate -eq "DocumentLibrary" -and $Libraries -contains $_.Title}|Foreach-Object{
    #Get the list in this site
    $list = $_;
    #Create a version each time you edit an item in this list (lists)
    #Create major versions (document libraries)
    $list.EnableVersioning = $true
    #Create major and minor (draft) versions (document libraries only)
    $list.EnableMinorVersions = $true
    #Keep the following number of versions (lists)
    #Keep the following number of major versions (document libraries)
    $list.MajorVersionLimit = 7
    #Keep drafts for the following number of approved versions (lists)
    #Keep drafts for the following number of major versions (document libraries)
    $list.MajorWithMinorVersionsLimit = 5
    #Update the list
    $list.Update()
    Stop-SPAssignment $spAssgn;
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • How to get specific folder and items in the document library sharepoint 2010

    I have a Shared library and it has Test folder and inside so many documents now i need to display the Test folder and items programmatically.
    Appreciate Help!!!!!
    Blitz

    This is how you could do it using the server object model -
    SPWeb site = SPContext.Current.Web;
    SPList list = site.Lists["listname"];
    SPQuery query = new SPQuery();
    SPFolder folder = list.RootFolder.SubFolders["FolderName"];
    query.Folder = folder;
    SPListItemCollection items = list.GetItems(query);
    foreach (SPListItem item in items)
    //do whatever you want here
    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's
    why

  • My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    First, empty the Trash if you haven't already done so.
    Use a tool such as OmniDiskSweeper (ODS) to explore your volume and find out what's taking up the space. You can delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Proceed further only if the problem hasn't been solved.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    Install ODS in the Applications folder as usual.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Triple-click the line of text below to select it, then drag or copy — do not type — into the Terminal window:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Press return. You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means.
    When you're done with ODS, quit it and also quit Terminal.

  • Iterate through all documents

    Hi,
    We have a container which contains *1 million* documents, each of which has size 5K. Container type is wholedocument. We need to iterate through all document regualrly using container.getAllDocuments(containerTxn, DBXML_LAZY_DOCS | DBXML_NO_INDEX_NODES). For each document, we will perform a xpath query in xml document in memory.
    The problem here is about whether we should use transaction. If transaction is used, getAllDocuments will report "Lock table is out of available lock entries" error when it scan about 9383 ducuments. Here are lock setting:
    envp->set_lk_max_lockers(6000);
    envp->set_lk_max_locks(6000);
    envp->set_lk_max_objects(8000);
    We have 1 million documents, it is impossible to set lock object to 1 million.
    My questions:
    (1) Is this normal? If so, why performing a dbxml query on the container doesn't cause such an error. I believe dbxml query has to iterate all of documents too.
    (2) Is it possible to use a seek position for getAllDocuments? Thus we can commit transaction every iterating 1000 documents, and then continue the iteration from the last seek position.
    (3) if we don't use transaction to call getAllDocuments, what possible problems will happen? Other threads are using transaction to read/update the documents.
    Thanks.
    -Yuan

    Yuan,
    The quickest thing to try is to add the flag DB_READ_COMMITTED to getAllDocuments(). That may reduce the number of locks you need. While you may not be able to set the various lock parameters to 1 million, you should set them much larger than you have now (e.g. 50k - 100k) for this sort of operation.
    Not using transactions at all can lead to inconsistent data mostly related to index consistency with document content. Depending on the nature of your updates it may be safe. You could get stray exceptions but nothing should crash. E.g. if you are only adding/removing documents you are probably safe without transactions; although you might iterate to a document that's been removed so you'll see an exception which would have to be ignored. I'm not 100% certain this will work well but if you can test it in a high-update environment and see no issues that will tell you. The read side will not interfere with the updates.
    As for "seeking" if you look under the covers getAllDocuments() is really just a wrapper for an index lookup on the name index. The XmlIndexLookup API is quite flexible in terms of returning ranges. If you want to look into returning ranges of documents, do this:
    1. look at the code in XmlContainer.cpp in the function "getDocs()". It uses XmlIndexLookup to perform the operation.
    2. look at the XmlIndexLookup API to figure out how to turn the lookup into a range lookup vs looking up ALL items in the index
    Using XmlIndexLookup and tracking the name of your last-used document you can easily ask for all documents "higher" than that one. Further, if you know how your documents are named lexicographically you can give it a maximum as well if you wanted, but given that you can set your XmlQueryContext to be lazy you can simply iterate N times to get the next N documents without paying a penalty retrieving any documents you don't need.
    For the sort of thing you are doing I highly recommend using XmlIndexLookup directly (with or without transactions) to get the flexibility you need. XmlContainer::getAllDocuments() is merely a "convenience" layer on that class.
    Regards,
    George

  • About a month ago my wifi switch greyed out. I went through all the trouble shooting and ended up going to the Genius Bar and got a new iPhone 4S. Now the switch greyed out on the new one.. help!

    About a month ago my wifi switch greyed out. I went through all the trouble shooting and ended up going to the Genius Bar and got a new iPhone 4S. Now the switch greyed out on the new one.. help!
    I've had my new one for less than 3 weeks. What gives? I'm loosing faith in apple

    no body?

  • PO - Document Type FO and Item Category B - Can they be transferred to SUS?

    Hi SDN
    We are using R/3 4.7 with SRM 5.0 - Classic Scenario and XI 4.0.  We are just about to launch an SUS project to put our PO's on SUS for our suppliers.  Our organization is dealing with PO's for both Goods and Services.  As we know that there are no problems about putting the GR-Type PO's (NB type) on SUS but I would like to know if it is possible to transfer PO's that would be from the Document Type FO and Item Category B (Blanket PO) to SUS and ensure that our suppliers can do the entire PO Acknowledgement, PO Change and post the Invoice via SUS.  If not, what are the options for our R/3 - SUS installation?
    Thanks!
    Eric L.
    Edited by: Eric Longpré on Apr 23, 2009 12:57 PM

    Hi,
    This has been discussed several times on this FORUM..Pls refer the foll threads for more details:
    PR document type in the back end system
    Change "Document Type in R/3 System" in SC
    Changing document type of PO backend
    Re: Change PO number/document type
    BR,
    Disha.
    Do reward points for useful answers.

  • Document level Data and Item level data

    Hi,
    Can anyone please explain the difference between Document level data and Item level data for sales order.
    Thanks
    shalini

    Item is the lowest level detail of the order. For ex it would be a particular material. Document would be the overall "top" level. Usually refered to as header level. It relates to everything in the document. 
    pts appreciated

  • SP2010 I need to set the include in search option switch on all document libraries to off across all site collections on the whole farm?

    SP2010 I need to set the include in search option switch on all document libraries to off across all site collections on the whole farm?
    Has anybody seen If this can be done programmatically any help would be gratefully welcomed thanks.

    i am not sure about the script, why not create crawl rule which will exclude the allitems.aspx from showing in the search results.
    Go to search service application, crawling section, click crawl rules to create a crawl rule to excludehttp://*allitems.aspx page.
    also check this:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/f431dd0e-871b-4f9e-990e-8f3b7ca932a4/crawl-rule-exclusion-sharepoint-2013
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • When I now use the cmd-tab shortcut to go to a different open application it madly scrolls through all the open applications and does not let me select one. Any ideas as to what might be wrong. It doesn't appear to be a sticking key?

    When I now use the cmd-tab shortcut to go to a different open application it madly scrolls through all the open applications and does not let me select one. Any ideas as to what might be wrong. It doesn't appear to be a sticking key?

    Problem with the cmd-tab keyboard shortcut now cured with the latest software update, so the original problem must have been a software glitch.

  • Please cancel my free Creative Cloud membership, fredrik@kva.se. I've been through all your info pages, and they direct me here.

    Please cancel my free Creative Cloud membership, [email protected] I've been through all your info pages, and they direct me here.

    There is nothing to cancel. It simply runs out. If you want your Adobe ID deleted, you have to contact support by web chat.
    Mylenium

  • How to stop indexing certain set of documents in Fast search for sharepoint 2010

    Hello
    Can someone help me to understand how to drop documents with the state as archived at the time of indexing, i meant how to stop indexing those documents in fast search for sharepoint 2010.
    Shweta
    Me

    Have you tried adding it to the exclude list?
    Include a file type in the content index (FAST Search
    Server 2010 for SharePoint)
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • How to make button to format a HardDrive or USB, How to remove all files from folder, and How to delete a process in listbox with a textbox?

    Hello!
    Here's the question with explaniation: How can i format the USB or Drive by clicking a button what's meant for it?
    and the second question what's also in vb.net: How can i remove all files from folder ? 
     Here's the Look of program: *
    Using the PC button, it will delete the free space of the PC, do you guys/girls know where it's location?

    Example Code:
    Imports System.Runtime.InteropServices
    Imports System.IO
    Public Class Form1
    Dim CBoxDrives As New ComboBox
    WithEvents FButton As New Button
    <DllImport("shell32.dll")> _
    Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, _
    ByVal fmtID As UInteger, ByVal options As UInteger) As ULong
    End Function
    Private Enum SHFormatFlags As Integer
    SHFMT_ID_DEFAULT = &HFFFF
    SHFMT_OPT_FULL = &H1
    SHFMT_OPT_SYSONLY = &H2
    SHFMT_ERROR = &HFFFFFFFF
    SHFMT_CANCEL = &HFFFFFFFE
    SHFMT_NOFORMAT = &HFFFFFFD
    SHFD_FORMAT_FULL = 0 ' full format
    SHFD_FORMAT_QUICK = 1 ' quick format
    End Enum
    Private Sub FButton_Click_1(sender As System.Object, e As System.EventArgs) Handles FButton.Click
    If CBoxDrives.Text = "" Then
    MsgBox("No Drive Selected")
    Exit Sub
    End If
    Dim Iresult As ULong = SHFormatDrive(CType(Me.Handle.ToInt32, IntPtr), CUInt(Asc(CBoxDrives.Text.Substring(0, 1)) - Asc("A")), CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), 1)
    End Sub
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.Size = New Size(200, 100)
    With FButton
    .Size = New Size(50, 25)
    .Location = New Point(5, 5)
    .Text = "Format"
    End With
    Me.Controls.Add(FButton)
    With CBoxDrives
    .Size = New Size(50, 25)
    .Location = New Point(75, 5)
    .DropDownStyle = ComboBoxStyle.DropDown
    End With
    Me.Controls.Add(CBoxDrives)
    Dim DrivesFound As Integer = 0
    Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
    Dim d As DriveInfo
    For Each d In allDrives
    If ((d.DriveType = DriveType.Fixed) Or (d.DriveType = DriveType.Removable)) AndAlso Environment.GetEnvironmentVariable("SYSTEMROOT").StartsWith(d.Name) = False Then
    CBoxDrives.Items.Add(d.Name)
    DrivesFound += 1
    End If
    Next
    CBoxDrives.SelectedIndex = DrivesFound - 1
    End Sub
    End Class

  • Changed permissions for a folder and items - now can't delete or open

    Hello
    I was recently playing around with the Get Info button when right clicking on a folder or icon. I was trying to lock the folder so it could not be accessed (except with a password). I ended up locking it with the check box, then changing the privileges to No Access at the bottom under Ownership and Permissions and Details (all drop down menus were set to No Access). Also, now the checkbox is greyed out, so I can't uncheck it...
    I was working on an external drive and then transferred the folder to my G5. However, while I can access the folder, I can not open the items I locked down. I also can not delete the folder and I keep getting "You Do not have sufficient privileges". I tried switching the Owner back to my own name (since it got set somehow to System), but after clicking the little lock and entering my password, it says "The operation could not be completed...An unexpected error occured (error code 120)".
    Basically, how can I delete this folder or move it to the trash? And also, is there any good way to lock down folders so you need a password to get in?
    Thank you
    Chris

    Deleting sandvox does not delete the customizations like udfs, forms. The actions that you perform in sandbox results in creation of the same in OIM db and also in metadata db.
    As a solution of the problem you can try creating a new sandbox and then create new versions of the application instance forms. Once done navigate the application instance and assign the newly created application instance form. This might work and you can ignore the earlier forms.

Maybe you are looking for