0

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

http://sharepoint/my/personal/admin/Shared%20Documents/

but now it not getting uploaded in the above path , its getting uploaded in

http://10.0.0.13:48487/Shared%20Documents 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

3
  • 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. Commented Aug 28, 2015 at 5:29
  • if i tried giving full url it throws exception Commented 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. Commented Aug 28, 2015 at 5:42

1 Answer 1

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.

4
  • but it always uploading 2 versions :O why its so @Pradip R Commented 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. Commented Aug 28, 2015 at 5:53
  • I checked...But i couldn't find any issue in the code Commented Aug 28, 2015 at 5:56
  • R here is my code..! sharepoint.stackexchange.com/a/154250/45380 Commented 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.