private bool UpdateProfileLiteSync(string scenario, string profileResourceId, string displayName, string personalStatus, string freeText, int flag) { MsnServiceState serviceState = new MsnServiceState(scenario, "UpdateProfile", false); StorageService storageService = (StorageService)CreateService(MsnServiceType.Storage, serviceState); UpdateProfileRequestType updateProfileRequest = new UpdateProfileRequestType(); updateProfileRequest.profile = new UpdateProfileRequestTypeProfile(); updateProfileRequest.profile.ResourceID = profileResourceId; ExpressionProfile expProf = new ExpressionProfile(); expProf.FreeText = freeText; expProf.DisplayName = displayName; expProf.Flags = flag; expProf.FlagsSpecified = true; if (!string.IsNullOrEmpty(personalStatus)) { expProf.PersonalStatus = personalStatus == null ? string.Empty : personalStatus; } updateProfileRequest.profile.ExpressionProfile = expProf; NSMessageHandler.ContactService.Deltas.Profile.DisplayName = displayName; NSMessageHandler.ContactService.Deltas.Profile.PersonalMessage = personalStatus; NSMessageHandler.ContactService.Deltas.Save(true); //Save no matter the request succeed or fail. try { ChangeCacheKeyAndPreferredHostForSpecifiedMethod(storageService, MsnServiceType.Storage, serviceState, updateProfileRequest); storageService.UpdateProfile(updateProfileRequest); } catch (Exception ex) { OnServiceOperationFailed(storageService, new ServiceOperationFailedEventArgs("UpdateProfile", ex)); Trace.WriteLineIf(Settings.TraceSwitch.TraceError, "UpdateProfile error: " + ex.Message, GetType().Name); return(false); } return(true); }
private bool UpdateProfileLiteSync(string scenario, string profileResourceId, string displayName, string personalStatus, string freeText, int flag) { MsnServiceState serviceState = new MsnServiceState(scenario, "UpdateProfile", false); StorageService storageService = (StorageService)CreateService(MsnServiceType.Storage, serviceState); UpdateProfileRequestType updateProfileRequest = new UpdateProfileRequestType(); updateProfileRequest.profile = new UpdateProfileRequestTypeProfile(); updateProfileRequest.profile.ResourceID = profileResourceId; ExpressionProfile expProf = new ExpressionProfile(); expProf.FreeText = freeText; expProf.DisplayName = displayName; expProf.Flags = flag; expProf.FlagsSpecified = true; if (!string.IsNullOrEmpty(personalStatus)) { expProf.PersonalStatus = personalStatus == null ? string.Empty : personalStatus; } updateProfileRequest.profile.ExpressionProfile = expProf; NSMessageHandler.ContactService.Deltas.Profile.DisplayName = displayName; NSMessageHandler.ContactService.Deltas.Profile.PersonalMessage = personalStatus; NSMessageHandler.ContactService.Deltas.Save(true); //Save no matter the request succeed or fail. try { ChangeCacheKeyAndPreferredHostForSpecifiedMethod(storageService, MsnServiceType.Storage, serviceState, updateProfileRequest); storageService.UpdateProfile(updateProfileRequest); } catch (Exception ex) { OnServiceOperationFailed(storageService, new ServiceOperationFailedEventArgs("UpdateProfile", ex)); Trace.WriteLineIf(Settings.TraceSwitch.TraceError, "UpdateProfile error: " + ex.Message, GetType().Name); return false; } return true; }