We have to upload about 50000 documents as attachments to items in a list (2-10 attachments per item). Requirements are: - We are not allowed to use Powershell. - We have tried to use CSOM, but site is using ADFS and we have problems with authorization in CSOM to connect to the site.

So our proposed solution is upload all the documents to a document library manually and with JavaScript move the documents to attachments of items in a list.

  1. Is there a better approach?
  2. Which would be the better system for uploading documents to document library (we are thingking in OneDrive client, which synchronizes with document library, but it has a 5000 elements limitation):

    Thanks in advance.


1 Answer 1


I would say a better approach is to create (register) SharePoint addin and use addin-only security with CSOM.

In order to obtain an addin-only access token you can install nuget package AppForSharePointOnlineWebToolkit and use TokenHelper.GetS2SAccessTokenWithWindowsIdentity(siteUrl, null) (for on-premise high-trust, since you specified tag sharepoint-server)

Also you can install OfficeDevPnPCore15 nuget package and use AuthenticationManager.GetADFSUserNameMixedAuthenticatedContext in order to obtain ClientContext bind to the specific ADFS user. Here is an overview around Authentication Manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.