private async Task<Message> PutAttribute(string objectID, string attrName, string attrValue, ModeType modeType) { ModifyRequest modifyRequest = new ModifyRequest(); Change changeRemoveAttribute = new Change(modeType, attrName, attrValue); modifyRequest.Change = new[] { changeRemoveAttribute }; return await PutAsync(objectID, modifyRequest); }
private async Task<Message> PutAsync(string objectID, ModifyRequest modifyRequest) { // Create the Put request messsage Message putRequestMsg = Message.CreateMessage(MessageVersion.Default, SoapConstants.PutAction, modifyRequest, new SoapXmlSerializer(typeof(ModifyRequest)) ); // Add the ResourceReferenceProperty header for the Put request putRequestMsg.Headers.Add(MessageHeader.CreateHeader("ResourceReferenceProperty", SoapConstants.RmNamespace, objectID)); putRequestMsg.Headers.Add(MessageHeader.CreateHeader("IdentityManagementOperation", SoapConstants.DirectoryAccess, null, true)); Message putResponseMsg = await _resourceClient.PutAsync(putRequestMsg); if (putResponseMsg.IsFault) throw new SoapFaultException("Put Fault: " + putResponseMsg); return putResponseMsg; }
/// <summary> /// Make multiple changes to a particular Identity Manager service object/resource (async await) /// </summary> /// <param name="objectID">Resource ID for the object containing the attributes to be modified</param> /// <param name="changes"> /// Set of changes (Multi-valued "Adds/Removes and Single-valued "Replaces" to be made for the single object /// </param> /// <returns>Task (async/await) of the asynchronous operation</returns> public async Task<Message> ChangeMultipleAttrbutes(string objectID, Change[] changes) { var modifyRequest = new ModifyRequest {Change = changes}; return await PutAsync(objectID, modifyRequest); }