0

Is there any easy way to upload documents/pictures into a users "My Site" Shared Documents/Pictures? Maybe using the user profile service?

The only way I can think to accomplish this is to first get the location of the users "My Site" and then look for the Shared Documents (or Pictures) list and if it is there, do my upload. Will this even work or is there an easier way?

2 Answers 2

0

Shared Documents in a My Site is a Document Library like any other, so you have the same options you would with a Document Library elsewhere. What permissions you have on those Document Libraries is obviously important, as they typically owned by the My Site owner.

Your approach might be different if the My Sites don't exist yet, or if they are a lot of them, etc. It's not really clear from your question exactly what you're trying to accomplish from a requirements perspective.

3
  • If you are doing it for the current user you can get the location of their MySite from their User Profile. Commented May 3, 2011 at 10:37
  • My goal is this (in a nut shell). I have my main intranet site, MyMainSite and on that site I want to make a web part that allows users to upload photos that become part of a photo gallery. But I was thinking it would make sense to store these photos in each users own "My Site" shared picture library instead of storing them on MyMainSite. So I was hoping there was a really easy way for me to just get programmatic access to the users shared MySite picture library. Sounds like I'm going to have to use the User Profile to get the MySite address & then do an OpenSite etc. Any other options?
    – TehOne
    Commented May 3, 2011 at 16:58
  • Sounds workable. Yes, use the User Profile, get the MySite location and then open the SPList for their Shared Picture library. Since the Web Part will be executing in the user's security context, you should not have any permission issues. Commented May 3, 2011 at 17:13
0

For future reference, the easiest way I found to get access to the users "My Site" lists was through the UserProfile. Like this...

ProfileLoader profileLoader = ProfileLoader.GetProfileLoader();
UserProfile userProfile = profileLoader.GetUserProfile();
userProfile.PersonalSite.RootWeb.Lists["Shared Pictures"]

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.