public MatterStampedDetails GetStampedProperties(MatterVM matterVM) { var matter = matterVM.Matter; var client = matterVM.Client; ClientContext clientContext = null; MatterStampedDetails matterStampedDetails = null; PropertyValues matterStampedProperties = null; try { clientContext = spoAuthorization.GetClientContext(matterVM.Client.Url); matterStampedProperties = matterRepositoy.GetStampedProperties(clientContext, matter.Name); Dictionary<string, object> stampedPropertyValues = matterStampedProperties.FieldValues; if (stampedPropertyValues.Count > 0) { string matterCenterUsers = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterCenterUsers); string matterCenterUserEmails = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterCenterUserEmails); List<List<string>> matterCenterUserCollection = new List<List<string>>(); List<List<string>> matterCenterUserEmailsCollection = new List<List<string>>(); if (!string.IsNullOrWhiteSpace(matterCenterUsers)) { matterCenterUserCollection = GetMatterAssignedUsers(matterCenterUsers); } if (!string.IsNullOrWhiteSpace(matterCenterUserEmails)) { matterCenterUserEmailsCollection = GetMatterAssignedUsers(matterCenterUserEmails); } matterStampedDetails = new MatterStampedDetails() { IsNewMatter = stampedPropertyValues.ContainsKey(matterSettings.StampedPropertyIsConflictIdentified) ? ServiceConstants.TRUE : ServiceConstants.FALSE, MatterObject = new Matter() { Id = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterID), MatterGuid = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterGUID), Name = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterName), Description = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterDescription), DefaultContentType = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyDefaultContentType), DocumentTemplateCount = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyDocumentTemplateCount).Split(new string[] { ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR }, StringSplitOptions.RemoveEmptyEntries).ToList(), Roles = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterCenterRoles).Split(new string[] { ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR }, StringSplitOptions.RemoveEmptyEntries).ToList(), Permissions = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyMatterCenterPermissions).Split(new string[] { ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR }, StringSplitOptions.RemoveEmptyEntries).ToList(), BlockUserNames = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyBlockedUsers).Split(new string[] { ServiceConstants.SEMICOLON }, StringSplitOptions.RemoveEmptyEntries).ToList(), AssignUserNames = matterCenterUserCollection.ToList<IList<string>>(), AssignUserEmails = matterCenterUserEmailsCollection.ToList<IList<string>>(), Conflict = new Conflict() { CheckBy = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyConflictCheckBy), CheckOn = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyConflictCheckDate), Identified = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyIsConflictIdentified), SecureMatter = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertySecureMatter), } }, MatterDetailsObject = ExtractMatterDetails(stampedPropertyValues), ClientObject = new Client() { Id = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyClientID), Name = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyClientName), } }; } } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } return matterStampedDetails; }
public async void Delete_Matter() { var matterVM = new MatterVM() { Client = new Client() { Url = "https://msmatter.sharepoint.com/sites/microsoft" }, Matter = new Matter() { Name = "Matter For Debugging Unit", MatterGuid = "1C0B1194EBF746DE829B8432A130EED3" } }; using (var testClient = testServer.CreateClient().AcceptJson()) { var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/deletematter", matterVM); var result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result; Assert.NotNull(result); } }
public GenericResponseVM DeleteMatter(MatterVM matterVM) { var client = matterVM.Client; var matter = matterVM.Matter; GenericResponseVM genericResponse = matterRepositoy.DeleteMatter(client, matter); return genericResponse; }