none
How to Move document Set from one document library to another document library?

    Question

  • Can Anyone  tell me a solution on moving document set from one document Library to another in same site[SharePOint Online]?

    Possible solution tried -

    1. Send to  dont work for Document Set

    2. SPD workflow  not moving the document set

    3. Send to another location cannot be used in our situation as  the configuration at the tenant level will be applicable to all the site collections and not for a specific site.

    4. Any client side script can be used. If yes, please help as this is not found to be available any where? 

    Please suggest the solution for this if third party app cannot be used.

    Tuesday, January 10, 2017 7:04 AM

All replies

  • This request is the same

    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/38bd69e1-534b-4b6b-ba0a-cf80654a4cf6/moving-document-set-from-one-document-library-to-another-library-in-same-site?forum=sharepointdevelopment

    Any answer/ solution, please post there


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Tuesday, January 10, 2017 7:23 AM
  • Hi PamShukla,

    As of now OOTB solution is not available to move document set from one library to another library even Move / copy action from "Site Content and Feature" is not worked for Document set as it is supported only file and items.

    We have faced similar issue and raised this to Microsoft, they provided custom solution with new CSOM dll (Version 16.1.4727.1200).

    For more information on this release read here

    https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365

    By this new DLL, you can export the document set and from target location and import it on source location.

    Sample code is here.

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.DocumentSet;
    
    namespace DocSetCSOM
    {
        class Program
        {
            static void Main(string[] args)
            {
                if (args.Length != 2)
                {
                    Console.WriteLine("Usage: DocSetCSOM.exe <newDocSetName> <docSetContentTypeName>");
                    return;
                }
                ClientContext context = new ClientContext("http://SPHVM-0311/");
                ContentTypeCollection contentTypes = context.Web.ContentTypes;
                context.Load(contentTypes);
                context.ExecuteQuery();
                //ContentType ct = context.Web.ContentTypes.GetById("0x0120D52000947B8344041D1340BEB4CE61C5049D11");
                //context.Load(ct, c => c.Id);
                //context.ExecuteQuery();
                ContentType docSetContentType = null;
                foreach (ContentType ct in contentTypes)
                {
                    if (ct.Name == args[1])
                    {
                        docSetContentType = ct;
                        break;
                    }
                }            
    
                List list = context.Web.Lists.GetByTitle("Documents");
                List target = context.Web.Lists.GetByTitle("target");
                Folder folder = context.Web.GetFolderByServerRelativeUrl("target/xyz");	
                ListItem listItem = list.GetItemById(2);
                
                DocumentSet docSet = DocumentSet.GetDocumentSet(context, listItem.Folder);
                ClientArrayResult<byte> data = docSet.ExportDocumentSet();
                context.ExecuteQuery();
    
                DocumentSet newDocSet = DocumentSet.ImportDocumentSet(context, data.Value, args[0], folder, docSetContentType.Id, context.Web.CurrentUser);
                context.ExecuteQuery();
    
                Console.WriteLine("Done");
            }
        }
    }


    Vivek Jagga
    My Blog
    Follow Linkedin Group   




    • Edited by Vivek Jagga Tuesday, January 10, 2017 9:22 AM
    Tuesday, January 10, 2017 9:19 AM


  • Please help me out for sharepoint online scenario where I need to run javascript or csom code to move document set from on document library to another on Sharepoint page  in editor web part or on page load whenever we select any document set it should be move

    Possible solution: I tried above code but Export and Import Document set dll[Microsoft.Office.DocumentManagement] not available for sharepoint online 


    Wednesday, January 11, 2017 8:55 AM
  • Can Anyone Please provide Microsoft.Office.DocumentManagement.DocumentSets.dll this dll for sharepoint online?
    Thursday, January 12, 2017 10:35 AM
  • Please suggest any solution for sharepoint online to move document set from one document library to other document library......
    Sunday, January 15, 2017 7:10 PM
  • Hello PamShukla,

    Follow below steps

    1. Start up Visual studio and Choose the project type you want to use. In below example we will use console application.
    2. Right click project properties and choose Manage NuGet Packages
    3. Search for “SharePoint Online Client Side Object Model” or “Microsoft.SharePointOnline.CSOM”. Notice the Created by and version information for the package.
    4. Click Install for the package so that it will be installed on the VS project.
      -You can alternatively open up NuGet Package Manager and execute following line: "Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.3912.1204"
    5. Verify that the references of the project has been changed
    6. You are ready to get started with your code.


    Vivek Jagga
    My Blog
    Follow Linkedin Group   


    • Edited by Vivek Jagga Monday, January 16, 2017 6:39 AM
    Monday, January 16, 2017 6:39 AM