I am running into a very strange issue.

I am working with SharePoint 2010 Site using Client Side Object Model(C#). I am not having SharePoint Server so I have created an windows application using c# CSOM to deal with SharePoint.

In my application I am dealing with creating so many document libraries and documents within it. The SharePoint site uses Kerberos authentication. For few hours lets say 2-3 hours it work successfully and creates document library and documents within it, but later on it start giving following error:

The remote server returned an error: (401) Unauthorized.

I am not able to find out the actual reason behind this. Same code runs for 2-3 hours and later on it starts giving error. I verified multiple time, the application runs for few hours and then suddenly start giving the above error.

So my question is what may be the possible reason for the above situation?

If any one have already passed from such situation then please provide valuable suggestions and help.


I am aware of Threshold limit. I am not crossing any threshold limit. Sometimes the error comes when documents count is less then 500 and sometimes it throws the error when document count is 4000.

The code structure which I am using is like

using (ClientContext clientContext = new ClientContext(siteUrl))
    CredentialCache myCache = new CredentialCache();
    myCache.Add(new Uri(siteUrl), "AuthType", new NetworkCredential(userName, password));
    clientContext.Credentials = myCache;
    //Document library related tasks    
  • which mode of authentication does your server use? Windows or Forms or both ? Regards Agasthya – agasthya Sep 7 '17 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.