I posted this because I could not find the answer to my problem anywhere. This Joel Oleson post , which describes a similar problem with mine, gave me a hint about where to look for the missing data. And This post from Corey Roth showed me how to programmatically add links to My Links users.
First of all, you need to restore a backup of the database containing My Links data. You do not want to restore your working database, you want to restore it in another place. Links stored in the SSP database. (You can find out the name of the database by going to Central Administration → Shared Services Administrator, then open the menu for the Shared Services Provider and click "Edit Properties" - the SSP database is listed on the properties page.)
:
:
SELECT UPF.NTName, UL.Url, UL.Title
FROM UserLinks UL INNER JOIN UserProfile_full UPF ON UL.recordID = UPF.recordID
INNER JOIN UserPrivacyPolicy UPP ON UL.PolicyId = UPP.id
ORDER BY NTName
( , , , , , , UserPrivacyPolicy)
Excel CSV ( ) - , , . Title Last, Title , , . ( , - , .)
. :
:
- Microsoft.Office.Server(C:\Program Files\Common Files\Microsoft Shared\ -\12\ISAPI\Microsoft.Office.Server.dll)
- Microsoft.SharePoint(C:\Program Files\Common Files\Microsoft Shared\ -\12\ISAPI\Microsoft.SharePoint.dll)
- System.Datali >
- System.Web
- System.Xml
:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Web;
namespace UserLinks
{
class Program
{
static void Main(string[] args)
{
string _accountName = "", _linkTitle = "", _url = "", _tmp = "", _path = "", _SPSsite = "";
if (args.Length != 2)
{
ShowUsage();
return;
}
_path = args[0];
_SPSsite = args[1];
using (SPSite _site = new SPSite(_SPSsite))
{
ServerContext _context = ServerContext.GetContext(_site);
UserProfileManager _userProfileManger = new UserProfileManager(_context);
TextReader _reader = new StreamReader(_path, System.Text.Encoding.Default);
while (_reader.Peek() != -1)
{
_tmp = _reader.ReadLine();
_accountName = _tmp.Substring(0, _tmp.IndexOf(','));
_tmp = _tmp.Replace(_accountName + ",", "");
_url = _tmp.Substring(0, _tmp.IndexOf(','));
_linkTitle = _tmp.Replace(_url + ",", "");
try
{
UserProfile _currentUser = _userProfileManger.GetUserProfile(_accountName);
QuickLinkManager _quickLinkManager = _currentUser.QuickLinks;
_quickLinkManager.Create(_linkTitle, _url, QuickLinkGroupType.General, null, Privacy.Private);
}
catch (Exception ex)
{
Console.WriteLine(_accountName);
Console.WriteLine(ex);
}
}
_reader.Close();
}
}
private static void ShowUsage()
{
Console.WriteLine("Usage");
Console.WriteLine("UserLinks [FilePath] [SharePoint URL]");
}
}
}
, " " .