views:

139

answers:

2

The below web services code has worked properly for me for over a year. We have updated our SharePoint servers, and now the below code throws an exception (at the bottom line of code) "Object reference not set to an instance of an object"

UserProfileWS.UserProfileService userProfileService = new UserProfileWS.UserProfileService();

userProfileService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

string serviceloc = "/_vti_bin/UserProfileService.asmx";
userProfileService.Url = _webUrl +  serviceloc;

UserProfileWS.PropertyData[] info = userProfileService.GetUserProfileByName(null);

EDIT: The service is still there. I browse http:///_vti_bin/UserProfileService.asmx, and the information for the service is still there, including the full description of the GetUserProfileByName call.

EDIT2: This does appear to be due to a change in SharePoint. I loaded a previous version of my software (known to be working), and it exhibits the same erroneous behavior.

A: 

When was the farm updated? Was the WSS updates installed before the MOSS updates? If you believe it to be a problem as a result of infrastructure updates, build a test farm and try the code against pre-updates (go back as far as a year ago to start off).

Will Sams
I don't think it's a problem of how the updates were applied. We installed a new test server and it's showing the exact same behavior.
Steve
A: 

try

UserProfileWS.PropertyData[] info = userProfileService.GetUserProfileByName(userName);

as specified http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.userprofileservice.getuserprofilebyname(v=office.12).aspx

Ciprian Grosu
That's exactly what I am doing. Passing a NULL for that userName parameter retrieves information for the current user. I have tried passing a valid userName string, and the same erroneous results happen.
Steve