Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have migrated a content database to a different server and attached it to a fresh web application. Now my issue is whenever it points to old site where users had created their own site. i don't want to restore mysite.

How do i remove the links from current site which i created on new server so that it does not point to old mysites and ask for login prompt.

if new server is http://server01:1000/ than for all the users who had configured their mysite on old server gets login prompt with link to old server as http://oldserver:1000/

Please help.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You should probably build something using the QuickLinkManager.

You get an instance of a manager from a UserProfile.

So basically you would either build it as a webpart on a page where the links is displayed. Or you need to write some application that iterates over all of your users and gets the UserProfile and then modify every link that contains your old server URL.

To get a user profile for the current user:

UserProfileManager userProfileManager = new UserProfileManager(ServerContext.Current);
UserProfile currentUser = userProfileManager.GetUserProfile(true);

and then to get the manager:

QuickLinkManager quickLinkManager = currentUser.QuickLinks;

This documentation shows you how to work with the links in manager, note that the namespace is Microsoft.Office.Server.UserProfiles, so you need to reference the Microsoft.Office.Server.UserProfiles.dll.

Good luck!

EDIT: You could also build this in a SharePoint PowerShell script, you just need to load the dll:s and do the same thing.

For loading all user profiles:

[System.Reflection.Assembly]::LoadWithPartialName
("Microsoft.Office.Server.UserProfiles")

$Site = Get-SPSite -Limit 1 

$ServiceContext = Get-SPServiceContext($Site)

$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)

$Profiles = $ProfileManager.GetEnumerator()

will give you an array of ally your user profiles.

Then iterate over the array, and the array of links in QuickLinkManager:

Foreach ($Profile in $Profiles) {
    Foreach ($link in $Profile.QuickLinks) {
         // DO THE MAGIC
    }
}

Note that this is just the basis of the code you will need, but I think you get the concept

share|improve this answer
    
poweshell is the only option for me. can you please guide me? –  Ishan May 4 '13 at 11:09
    
See update, it is not complete code, but it should get you on a good start. Just remember to use the SharePoint Management Console or load the sharepoint cmdlets: Add-PSSnapin Microsoft.SharePoint.PowerShell –  Robert Lindgren May 4 '13 at 11:23
    
The above code gives all the users whose profiles exist in the site. My issue is i have moved contentdb from one server to another. The users who had their mysite configured have old links to their profile pic as http://oldserver:1000/test/image.jpg i want to change it to http://server01:1000/test/image.jpg. How can i do it? The above code does not list the user who have their mysite on old server.Please help –  Ishan May 6 '13 at 5:46
    
Well thats was really a new question compared to what you have written above. Maybe you should rewrite your question to make it more clear what you want. –  Robert Lindgren May 6 '13 at 6:08
add comment

For those who have issue with only image url pointing to old server here is the solution

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.