Hi,
I am working on AD sync up activity, There are two phases in my activity
1. SharePoint user profile sync service extract data from AD,
2. once its done my windows service pull the user profile data from SharePoint user profile sync service to SQL Server (my existing) database.
everything is working fine in my local, but in the server machine I am facing difficulty.
First activity is working fine i.e. SharePoint user profile sync service extract data from AD is working fine even I have checked some of the users profiles in the site ,but my second activity i.e. windows task(exe) generating "Object reference not set an instance of an object" error.
here is my sample code
using (SPSite destSite = new SPSite(ConfigurationManager.AppSettings["mySharepointAppurl"]))
{
SPServiceContext sps = SPServiceContext.GetContext(destSite);
UserProfileManager upMgr = new UserProfileManager(sps);
foreach (UserProfile up in upMgr)
{
try
{
string OUlevel= "";
try
{
OUlevel= Convert.ToString(up[PropertyConstants.JobTitle].Value).Trim();
}
catch (Exception ex)
{
Console.Write(ex.Message + "\n");
}
}
continues.....
The below points are already verified.
1. Running Exe using Farm admin account
2.My site is associated with User Profile sync service
If you feel I have to verify anything else please share your points.
Its really urgent. could you please share your knowledge asap, Thanks in advance.....