Hi previously i have asked for a question and i have sorted the answer for it Upload a file in SharePoint server from a local machine connected through LAN using c# .But unfortunately the files are not getting uploaded into Shared Documents (ie) i want the file to get upload under the shared document of the logged in user (eg) in this path


but now it not getting uploaded in the above path , its getting uploaded in and also i can only able to access the files in above path by manually entering the URL in address bar .!

I want my file to get upload under the personal/my content/shared Document of the logged in user .!

NOTE : i was pointing the shared socument in c# while uploading the file using
SP.List documentsList = clientContext.Web.Lists.GetByTitle("Shared Document");

If i tried giving the full url in cliecntContext its throwing exception as

Cannot contact site at the specified URL http://sharepoint/my/personal/admin/Shared%20Documents/Forms/AllItems.aspx. There is no Web named "/my/personal/admin/Shared

  • Did you try giving Site URL as your my site URL in ClientContext? Because if you give your my site URL in it, it will only upload to that Shared Document library only.
    – Pradip R.
    Aug 28, 2015 at 5:29
  • if i tried giving full url it throws exception
    – Dah Sra
    Aug 28, 2015 at 5:31
  • 1
    ClientContext will not find any web if you give full url. You need to give url till admin, for example http://sharepoint/my/personal/admin. Not the full url with document library name.
    – Pradip R.
    Aug 28, 2015 at 5:42

1 Answer 1


Make sure you are retrieving the ClientContext object for your my site only.

For example you can try this code snippet:

ClientContext clientContext = new ClientContext("http://sharepoint/my/personal/admin");

This will load your context of admin site web only, so that you can successfully find the document library and upload the file in it.

  • but it always uploading 2 versions :O why its so @Pradip R
    – Dah Sra
    Aug 28, 2015 at 5:49
  • Well, it should not upload 2 versions, there might be some code defects in it. I would suggest you to debug the code and check why you are seeing two versions.
    – Pradip R.
    Aug 28, 2015 at 5:53
  • I checked...But i couldn't find any issue in the code
    – Dah Sra
    Aug 28, 2015 at 5:56
  • R here is my code..! sharepoint.stackexchange.com/a/154250/45380
    – Dah Sra
    Aug 28, 2015 at 5:57

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.