public async void Pin_User_Document() { var pinRequestVM = new PinRequestDocumentVM() { Client = new Client() { Id = "123456", Name = "Microsoft", Url = "https://microsoft.sharepoint.com/teams/mcuisite" }, DocumentData = new DocumentData() { DocumentName= "Document", DocumentVersion= "2.0", DocumentClient= "Microsoft", DocumentClientId= "100002", DocumentClientUrl= "https://svalli.sharepoint.com/sites/mc", DocumentMatter= "For Matter Center", DocumentMatterId= "123456", DocumentOwner= "Lakshmanaswamy Premchand Peddakotla", DocumentUrl= "https://svalli.sharepoint.com/sites/mc/9c069bd7e681628e5107a87bfc49e648/emails/document2.docx", DocumentOWAUrl= "https://svalli.sharepoint.com/sites/mc/_layouts/WopiFrame.aspx?sourcedoc=https%3A%2F%2Fsvalli.sharepoint.com%2Fsites%2Fmc%2F9c069bd7e681628e5107a87bfc49e648%2FEmails%2FDocument.docx&action=default&DefaultItemOpen=1", DocumentExtension= "docx", DocumentCreatedDate= "2016-02-19T21:37:36Z", DocumentModifiedDate= "2/19/2016 9:37:53 PM", DocumentCheckoutUser= "******", DocumentMatterUrl= "https://svalli.sharepoint.com/sites/mc/9c069bd7e681628e5107a87bfc49e648", DocumentParentUrl= "https://svalli.sharepoint.com/sites/mc/9c069bd7e681628e5107a87bfc49e648/Emails", DocumentID= "MICROSOFT-1625733529-9" } }; using (var testClient = testServer.CreateClient().AcceptJson()) { var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/document/pindocument", pinRequestVM); var result = response.Content.ReadAsStringAsync().Result; Assert.NotNull(result); } }
/// <summary> /// Removes pinned item from user pinned document list. /// </summary> /// <param name="pinRequestDocumentVM"></param> /// <returns></returns> public bool UnPinDocument(PinRequestDocumentVM pinRequestDocumentVM) { try { using (clientContext = spoAuthorization.GetClientContext(pinRequestDocumentVM.Client.Url)) { return UnPinThisRecord(clientContext, pinRequestDocumentVM.Client, pinRequestDocumentVM.DocumentData, false); } } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async void UnPin_User_Document() { var pinRequestVM = new PinRequestDocumentVM() { Client = new Client() { Id = "123456", Name = "Microsoft", Url = "https://microsoft.sharepoint.com/teams/mcuisite" }, DocumentData = new DocumentData() { DocumentUrl = "https://svalli.sharepoint.com/sites/mc/e0421c5e7fbf704023871b2acf64370m/Forms/AllItems.aspx" } }; using (var testClient = testServer.CreateClient().AcceptJson()) { var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/document/unpindocument", pinRequestVM); var result = response.Content.ReadAsStringAsync().Result; Assert.NotNull(result); } }