How do you use the CopyIntoItems method of the SharePoint Copy web service?

前端 未结 3 1205
暗喜
暗喜 2021-01-06 11:25

I am attempting to load document files into a document library in SharePoint using the CopyIntoItems method of the SharePoint Copy web service.

The code below execut

3条回答
  •  孤街浪徒
    2021-01-06 11:55

    I think the issue may be in trying to set the "Name" property using the webservice. I have had some fail doing that. Given the "Name" is the name of the document, you may have some success with

        string targetDocName = "Test1Name.txt";
        string destinationUrl = Uri.EscapeDataString("https://someaddress.com/Reports/Temp/" + targetDocName);
        string[] destinationUrls = { destinationUrl };
    
        SPCopyWebService.FieldInformation i1 = new SPCopyWebService.FieldInformation { DisplayName = "Title", InternalName = "Title", Type = SPListTransferSpike1.SPCopyWebService.FieldType.Text, Value = "Test1Title" };
        SPCopyWebService.FieldInformation[] info = { i1};
        SPCopyWebService.CopyResult[] result;
        byte[] data = File.ReadAllBytes("C:\\SomePath\\Test1Data.txt");
        uint ret = SPCopyNew.CopyIntoItems(destinationUrl, destinationUrls, info, data, out result);
    

    Note: I have used the "target" as the "source" property. Don't quite know why, but it does the trick.

提交回复
热议问题