Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Automatically Upload Pictures from Sharepoint local drive to SharePoint User Profile store using C#

$
0
0

I have 10,000 image files(profile pictures) stored at location C:\ProfilePic\ folder. The Local Drive(C:\ProfilePic\) is in the same machine where SharePoint Server is installed.
Image Files are as below.
DomainName_UserID1.jpg,
DomainName_UserID2.jpg,
DomainName_UserID3.jpg  etc.
I need to upload these images to the SharePoint UserProfile Store for respective users.
Is that possible to write a console application that can query through the pictures saved in theC:\ProfilePic\ folder, and then upload the Pictures directly from Local Drive to User Profile Store.

The code will do something like below:

Foreach(Images saved in C:\ProfilePicFolder)

{

string DomainName=Images.split(‘_’)[0];

string UserID=Images.split(‘_’)[1];

string AccountName=DomainName+”\”+UserID;

SPServiceContext context=ServiceContext.GetContext(site);

UserprofileManager upm=new UserProfileManager(context);

UserProfile up=upm.GetUserProfile(AccountName);

…………………………….

up[“ImageUrl”].Value=Images from C:\ProfilePic Folder ;

up.Commit();

}


Viewing all articles
Browse latest Browse all 7589

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>