Quantcast
Channel: Data Protection Manager -SharePoint Protection forum
Viewing all articles
Browse latest Browse all 263

Extracting user profile data from Sharepoint user profile sync service using windows service(exe)

$
0
0

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.....

  




Viewing all articles
Browse latest Browse all 263

Trending Articles



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