Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

resource update - eliminate resource that doesn't exist in AD anymore

$
0
0

hello forum members,

i am trying to write code that goes through all resources and updates some custom fields. However, something must have been set up wrong because I am getting a lot of users who are no longer exist in the AD group that is synced to the security group in Project Server and my code keeps erroring out.

can anyone recommend any code on how to eliminate users who no longer exist in AD?

 if (checkedOut)
                    {
                        SvcResource.ResourceDataSet updateDs = resourceSvc.ReadResource(resourceRow.RES_UID);

                        if (check here if resource is a valid resource)
                        {


                            updateDs.Resources[0].RES_CODE = "A" + rand.Next(1000, 9999);
                            Console.WriteLine("Update RES_CODE to " + updateDs.Resources[0].RES_CODE);
                            resourceSvc.UpdateResources(updateDs, false, false);
                            Console.WriteLine("Check in " + resourceRow.RES_NAME);
                            resourceSvc.CheckInResources(new Guid[] { resourceRow.RES_UID }, false);


                        }
                        else
                        {
                        }
                    }
                   


tatiana


Viewing all articles
Browse latest Browse all 5347

Trending Articles



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