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();
}