public Attachments() { using (var store = new DocumentStore()) { { #region delete_1 store.Operations.Send(new DeleteAttachmentOperation("orders/1-A", "invoice.pdf")); #endregion } { #region get_1 store.Operations.Send(new GetAttachmentOperation("orders/1-A", "invoice.pdf", AttachmentType.Document, changeVector: null)); #endregion } { Stream stream = null; #region put_1 AttachmentDetails attachmentDetails = store.Operations.Send( new PutAttachmentOperation("orders/1-A", "invoice.pdf", stream, "application/pdf")); #endregion } } }
public async Task <Response <AttachmentDoc> > UploadDoc(AttachmentDoc model) { try { AttachmentHeader header = new AttachmentHeader(); header = model.AttachmentHeaderItem; header.Is_Active = true; _context.AttachmentHeader.Add(header); await _context.SaveChangesAsync(); AttachmentDetails details = new AttachmentDetails(); details = model.AttachmentDetailsItem; details.Is_Active = true; details.Attachment_Header_ID = header.Attachment_Header_ID; _context.AttachmentDetails.Add(details); await _context.SaveChangesAsync(); return(new Response <AttachmentDoc>() { IsSuccess = true, Model = model }); } catch (Exception ex) { _log.Error(ex, _user.GetCurrentUser().User_Name); return(new Response <AttachmentDoc>() { IsSuccess = false, Message = ex.Message }); } }
public void Should_SetActive() { AttachmentDetails attachmentDetails = new AttachmentDetails(key, value, attachmentId); attachmentDetails.SetActive(); Assert.True(attachmentDetails.IsActive); }
public void Should_DeActive() { AttachmentDetails attachmentDetails = new AttachmentDetails(key, value, attachmentId); attachmentDetails.DeActive(); Assert.False(attachmentDetails.IsActive); }
public void Should_Update() { AttachmentDetails attachmentDetails = new AttachmentDetails(key, value, attachmentId); attachmentDetails.Update(key, value); attachmentDetails.ShouldNotBeNull(); }
public void SelectAttachment(int index) { if (_currentShipAttachmentHolder != null) { AttachmentDetails attachmentDetails = _currentShipAttachmentHolder.SelectAttachment(index); _attachmentSelectedEvent.TriggerEvent(_playerId, attachmentDetails); } }
public void Should_Construct_AttachmentDetails() { AttachmentDetails attachmentDetails = new AttachmentDetails(key, value, attachmentId); _ = new AttachmentDetails(); _ = attachmentDetails.Id; _ = attachmentDetails.Attachment; attachmentDetails.ShouldNotBeNull(); }
public async void Test_Doc_Attachment() { var attachments = new List <AttachmentDetails>(); AttachmentDetails attachmentDetails = new AttachmentDetails() { attachmentType = "0", name = "program to modify MARCH2016.docx", originalName = "program to modify MARCH2016.docx", isInline = false, contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", id = "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAE+eM8AAABEgAQAGDuo5aZZdBAnm7TVKY1EoE=", size = 335497 }; attachments.Add(attachmentDetails); var foldePath = new List <string>(); foldePath.Add("/sites/microsoft/1C0B1194EBF746DE829B8432A130EED3/Documents"); var serviceRequestVM = new ServiceRequest() { AllowContentCheck = true, AttachmentToken = "eyJpc3MiOiIwMDAwMDAwMi0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDBAM2M0NTYyY2EtMzlhNC00ZDhiLTkxZmYtNmQzZWVmYWI1YzFkIiwiYXVkIjoiMDAwMDAwMDItMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL291dGxvb2sub2ZmaWNlMzY1LmNvbUAzYzQ1NjJjYS0zOWE0LTRkOGItOTFmZi02ZDNlZWZhYjVjMWQiLCJuYmYiOjE0NjM0MjMwODcsImV4cCI6MTQ2MzQyMzM4NywibmFtZWlkIjoiMTA3OGNjMjQtZTg5Yy00OGY4LWFmYTEtY2IzMzIxNjM2OTY2QDNjNDU2MmNhLTM5YTQtNGQ4Yi05MWZmLTZkM2VlZmFiNWMxZCIsInZlciI6IkV4Y2hhbmdlLkNhbGxiYWNrLlYxIiwiYXBwY3R4c2VuZGVyIjoiaHR0cHM6Ly9tYXR0ZXJ3ZWJhcHAuYXp1cmV3ZWJzaXRlcy5uZXRAM2M0NTYyY2EtMzlhNC00ZDhiLTkxZmYtNmQzZWVmYWI1YzFkIiwiYXBwY3R4Ijoie1wib2lkXCI6XCI5MzNjZTFmZC0yNjkzLTRhYWUtYjdiYS0yYTBiNjhlNDEwMjlcIixcInB1aWRcIjpcIjEwMDNCRkZEOTc3QTM4REJcIixcInNtdHBcIjpcIm1hdHRlcmFkbWluQE1TbWF0dGVyLm9ubWljcm9zb2Z0LmNvbVwiLFwidXBuXCI6XCJtYXR0ZXJhZG1pbkBNU21hdHRlci5vbm1pY3Jvc29mdC5jb21cIixcInNjb3BlXCI6XCJQYXJlbnRJdGVtSWQ6QUFNa0FERm1NemhoTm1RMkxXRm1ZVFF0TkdFM1lTMWhPRGRpTFdRMk5HTXlOVGcwT0dZNVpnQkdBQUFBQUFBZlRVcEdlVzlZUTR1YzUzcVJjV3VvQndDdGc3ZFJGcGFZVHI3bm91RXBXK2M2QUFBQUFBRU1BQUN0ZzdkUkZwYVlUcjdub3VFcFcrYzZBQUFKZ1JvS0FBQT1cIn0ifQ.b1emwSawJwObcPJ5i8t4Y2GpYgmYyjxMtX-CkTmO72S6nhroYI1fqe_VlCjzkkGBvmRQ6BZslYaukem3mh_GPQAJAhOCcmFx5lVxJ3Ttivol-PHLMoQWUf9DloDo0_nIENLm9LFwqvYK2Yhp5zNTF9TMu7PDcuw2dKbTZqTQUm99y-ajqNx1tj1Zu23iXJj--DEjXdzSDtPzoAOhWyvq9c4WuvSbE07bXtXpIe0hf_A3MO7L4W2ERuJuiDmA_E1YanxzD9iSrN1vlSbLHdRI_hoqON0i3vUUjDYyeW5qNvpOLJfy48Uz5p1Tx_arIL5HXkHv6mI31jXwY8B3okzGJg", Attachments = attachments, EwsUrl = new System.Uri("https://outlook.office365.com/EWS/Exchange.asmx"), DocumentLibraryName = "Matter For Debugging Unit", FolderPath = foldePath, MailId = "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAE+eM8AAA=", PerformContentCheck = false, Overwrite = false, Subject = "Test email" }; var matterClient = new Client() { Url = "https://msmatter.sharepoint.com/sites/microsoft" }; var attachmentRequestVM = new AttachmentRequestVM() { ServiceRequest = serviceRequestVM, Client = matterClient }; using (var client = testServer.CreateClient().AcceptJson()) { var response = await client.PostAsJsonAsync("http://localhost:44323/api/v1/document/uploadattachments", attachmentRequestVM); var result = response.Content.ReadAsStringAsync().Result; Assert.NotNull(result); } }
public override int Execute(DocumentsOperationContext context) { try { Result = Database.DocumentsStorage.AttachmentsStorage.PutAttachment(context, DocumentId, Name, ContentType, Hash, ExpectedChangeVector, Stream); } catch (ConcurrencyException e) { ExceptionDispatchInfo = ExceptionDispatchInfo.Capture(e); } return(1); }
public void GetAttachment() { using (var store = new DocumentStore()) { #region GetAttachment using (var session = store.OpenSession()) { Album album = session.Load <Album>("albums/1"); using (AttachmentResult file1 = session.Advanced.Attachments.Get(album, "001.jpg")) using (AttachmentResult file2 = session.Advanced.Attachments.Get("albums/1", "002.jpg")) { Stream stream = file1.Stream; AttachmentDetails attachmentDetails = file1.Details; string name = attachmentDetails.Name; string contentType = attachmentDetails.ContentType; string hash = attachmentDetails.Hash; long size = attachmentDetails.Size; string documentId = attachmentDetails.DocumentId; string changeVector = attachmentDetails.ChangeVector; } AttachmentName[] attachmentNames = session.Advanced.Attachments.GetNames(album); foreach (AttachmentName attachmentName in attachmentNames) { string name = attachmentName.Name; string contentType = attachmentName.ContentType; string hash = attachmentName.Hash; long size = attachmentName.Size; } bool exists = session.Advanced.Attachments.Exists("albums/1", "003.jpg"); } #endregion } }
public void DisplayAttachmentDescription(AttachmentDetails details) { _nameText.text = details.Name; _descText.text = details.Description; }
protected override long ExecuteCmd(DocumentsOperationContext context) { Result = Database.DocumentsStorage.AttachmentsStorage.PutAttachment(context, DocumentId, Name, ContentType, Hash, ExpectedChangeVector, Stream); return(1); }
public ActionResult Create(TicketsViewModel ticketsViewModel) { try { if (ModelState.IsValid) { if (ticketsViewModel.HiddenUserId == null) { ticketsViewModel.ListofCategory = _category.GetAllActiveSelectListItemCategory(); ticketsViewModel.ListofPriority = _priority.GetAllPrioritySelectListItem(); ticketsViewModel.Message = string.Empty; ModelState.Remove("Message"); TempData["ErrorMessageTicket"] = "Name is AutoComplete field Don't Enter Name Choose."; return(View(ticketsViewModel)); } var file = Request.Files; var generate = new GenerateTicketNo(); var applicationNo = generate.ApplicationNo(_category.GetCategoryCodeByCategoryId(ticketsViewModel.CategoryId)); var tickets = AutoMapper.Mapper.Map <Tickets>(ticketsViewModel); tickets.TicketId = 0; tickets.CreatedDate = DateTime.Now; tickets.TrackingId = applicationNo; tickets.StatusAssigned = false; tickets.InternalUserId = Convert.ToInt64(_sessionHandler.UserId); var message = AppendSignature(ticketsViewModel.Message); var ticketDetails = new TicketDetails() { Subject = ticketsViewModel.Subject, Message = message, TicketDetailsId = 0 }; var attachments = new Attachments(); var attachmentdetails = new AttachmentDetails(); // ReSharper disable once CollectionNeverQueried.Local var listofattachments = new List <Attachments>(); // ReSharper disable once CollectionNeverQueried.Local var listofattachmentdetails = new List <AttachmentDetails>(); for (int i = 0; i <= file.Count - 1; i++) { if (file[i] != null && file[i].ContentLength > 0) { string extension = Path.GetExtension(file[i].FileName); attachments.UserId = Convert.ToInt64(_sessionHandler.UserId); attachments.AttachmentName = file[i].FileName; attachments.AttachmentType = extension; attachments.CreatedDate = DateTime.Now; var inputStream = file[i].InputStream; if (inputStream != null) { using (var binaryReader = new BinaryReader(inputStream)) { byte[] fileSize = binaryReader.ReadBytes(count: file[i].ContentLength); attachmentdetails.AttachmentBytes = fileSize; } } listofattachments.Add(attachments); listofattachmentdetails.Add(attachmentdetails); } } var ticketId = _tickets.AddTickets(ticketsViewModel.HiddenUserId, tickets, ticketDetails, listofattachments, listofattachmentdetails); if (ticketId != -1) { TempData["MessageTicket"] = applicationNo + ' ' + CommonMessages.TicketSuccessMessages; TicketHistoryHelper ticketHistoryHelper = new TicketHistoryHelper(); var ticketHistory = new TicketHistory(); ticketHistory.UserId = Convert.ToInt32(_sessionHandler.UserId); ticketHistory.Message = ticketHistoryHelper.CreateMessage(tickets.PriorityId, tickets.CategoryId); ticketHistory.CategoryId = tickets.CategoryId; ticketHistory.PriorityId = tickets.PriorityId; ticketHistory.StatusId = Convert.ToInt16(StatusMain.Status.Open); ticketHistory.ProcessDate = DateTime.Now; ticketHistory.TicketId = ticketId; ticketHistory.ActivitiesId = Convert.ToInt16(StatusMain.Activities.Created); _ticketHistory.TicketHistory(ticketHistory); } else { TempData["ErrorMessageTicket"] = CommonMessages.TicketErrorMessages; } return(RedirectToAction("Create", "TicketHOD")); } else { ticketsViewModel.ListofCategory = _category.GetAllActiveSelectListItemCategory(); ticketsViewModel.ListofPriority = _priority.GetAllPrioritySelectListItem(); return(View(ticketsViewModel)); } } catch (Exception) { throw; } }
public ActionResult EditTicket(TicketsUserViewModel ticketsViewModel) { try { if (ModelState.IsValid) { if (Request != null && (_attachments.AttachmentsExistbyTicketId(ticketsViewModel.TicketId) && Request.Files["fileupload_1"].ContentLength != 0 && Request.Files["fileupload_2"].ContentLength != 0 && Request.Files["fileupload_3"].ContentLength != 0)) { ModelState.AddModelError("", "Delete Pervious uploaded Attachments for Uploading New Attachments"); ticketsViewModel.HasAttachment = _attachments.CheckAttachmentsExistbyTicketId(ticketsViewModel.TrackingId); ticketsViewModel.ListofCategory = _category.GetAllActiveSelectListItemCategory(); ticketsViewModel.ListofPriority = _priority.GetAllPrioritySelectListItem(); ticketsViewModel.ListofAttachments = _attachments.GetListAttachmentsByAttachmentId(ticketsViewModel.TicketId); return(View(ticketsViewModel)); } else { var attachments = new Attachments(); var attachmentdetails = new AttachmentDetails(); // ReSharper disable once CollectionNeverQueried.Local var listofattachments = new List <Attachments>(); // ReSharper disable once CollectionNeverQueried.Local var listofattachmentdetails = new List <AttachmentDetails>(); if (Request != null && Request.Files.AllKeys.Any()) { var file = Request.Files; if (Request.Files["fileupload_1"].ContentLength != 0 || Request.Files["fileupload_2"].ContentLength != 0 || Request.Files["fileupload_3"].ContentLength != 0) { for (int i = 0; i <= file.Count - 1; i++) { if (file[i] != null && file[i].ContentLength > 0) { string fileName = Path.GetFileName(file[i].FileName); string extension = Path.GetExtension(file[i].FileName); attachments.UserId = Convert.ToInt64(_sessionHandler.UserId); attachments.AttachmentName = fileName; attachments.AttachmentType = extension; attachments.CreatedDate = DateTime.Now; var inputStream = file[i]?.InputStream; if (inputStream != null) { using (var binaryReader = new BinaryReader(inputStream)) { byte[] fileSize = binaryReader.ReadBytes(count: file[i].ContentLength); attachmentdetails.AttachmentBytes = fileSize; } } listofattachments.Add(attachments); listofattachmentdetails.Add(attachmentdetails); } } var message = AppendSignature(ticketsViewModel.Message); ticketsViewModel.Message = message; _tickets.UpdateTickets(ticketsViewModel, listofattachments, listofattachmentdetails); TicketHistoryHelper ticketHistoryHelper = new TicketHistoryHelper(); TicketHistory ticketHistory = new TicketHistory { UserId = Convert.ToInt32(_sessionHandler.UserId), Message = ticketHistoryHelper.EditTicket(), ProcessDate = DateTime.Now, TicketId = ticketsViewModel.TicketId, ActivitiesId = Convert.ToInt16(StatusMain.Activities.EditedTicket) }; _ticketHistory.TicketHistory(ticketHistory); TempData["TicketReplyMessage"] = CommonMessages.TicketUpdatedSuccessReplyMessages; } else { ticketsViewModel.Message = AppendSignature(ticketsViewModel.Message); _tickets.UpdateTickets(ticketsViewModel, null, null); TicketHistoryHelper ticketHistoryHelper = new TicketHistoryHelper(); TicketHistory ticketHistory = new TicketHistory { UserId = Convert.ToInt32(_sessionHandler.UserId), Message = ticketHistoryHelper.EditTicket(), ProcessDate = DateTime.Now, TicketId = ticketsViewModel.TicketId }; _ticketHistory.TicketHistory(ticketHistory); TempData["TicketReplyMessage"] = CommonMessages.TicketUpdatedSuccessReplyMessages; } } } } return(RedirectToAction("Details", "TicketDetailsHOD", new { trackingId = ticketsViewModel.TrackingId })); } catch (Exception) { throw; } }
// attachments multi-get // BulkInsert.a few attachments and then get them with a single request public async void AttachmentsMultiGet() { using (var store = getDocumentStore()) { // Create documents to add attachments to using (var session = store.OpenSession()) { var user1 = new User { Name = "Lilly", Age = 20 }; session.Store(user1); var user2 = new User { Name = "Betty", Age = 25 }; session.Store(user2); var user3 = new User { Name = "Robert", Age = 29 }; session.Store(user3); session.SaveChanges(); } List <User> result; using (var session = store.OpenSession()) { IRavenQueryable <User> query = session.Query <User>() .Where(u => u.Age < 30); result = query.ToList(); } // Query for users younger than 30, add an attachment using (var bulkInsert = store.BulkInsert()) { for (var user = 0; user < result.Count; user++) { byte[] byteArray = Encoding.UTF8.GetBytes("some contents here"); var stream = new MemoryStream(byteArray); string userId = result[user].Id; var attachmentsFor = bulkInsert.AttachmentsFor(userId); for (var attNum = 0; attNum < 10; attNum++) { stream.Position = 0; await attachmentsFor.StoreAsync(result[user].Name + attNum, stream); } } } // attachments multi-get (sync) using (var session = store.OpenSession()) { for (var userCnt = 0; userCnt < result.Count; userCnt++) { string userId = result[userCnt].Id; #region GetAllAttachments // Load a user profile var user = session.Load <User>(userId); // Get the names of files attached to this document IEnumerable <AttachmentRequest> attachmentNames = session.Advanced.Attachments.GetNames(user).Select(x => new AttachmentRequest(userId, x.Name)); // Get the attached files IEnumerator <AttachmentEnumeratorResult> attachmentsEnumerator = session.Advanced.Attachments.Get(attachmentNames); // Go through the document's attachments while (attachmentsEnumerator.MoveNext()) { AttachmentEnumeratorResult res = attachmentsEnumerator.Current; AttachmentDetails attachmentDetails = res.Details; // attachment details Stream attachmentStream = res.Stream; // attachment contents // In this case it is a string attachment, that can be decoded back to text var ms = new MemoryStream(); attachmentStream.CopyTo(ms); string decodedStream = Encoding.UTF8.GetString(ms.ToArray()); } #endregion } } // attachments multi-get (Async) using (var session = store.OpenAsyncSession()) { for (var userCnt = 0; userCnt < result.Count; userCnt++) { string userId = result[userCnt].Id; #region GetAllAttachmentsAsync // Load a user profile var user = await session.LoadAsync <User>(userId); // Get the names of files attached to this document IEnumerable <AttachmentRequest> attachmentNames = session.Advanced.Attachments.GetNames(user).Select(x => new AttachmentRequest(userId, x.Name)); // Get the attached files IEnumerator <AttachmentEnumeratorResult> attachmentsEnumerator = await session.Advanced.Attachments.GetAsync(attachmentNames); // Go through the document's attachments while (attachmentsEnumerator.MoveNext()) { AttachmentEnumeratorResult res = attachmentsEnumerator.Current; AttachmentDetails attachmentDetails = res.Details; // attachment details Stream attachmentStream = res.Stream; // attachment contents // In this case it is a string attachment, that can be decoded back to text var ms = new MemoryStream(); attachmentStream.CopyTo(ms); string decodedStream = Encoding.UTF8.GetString(ms.ToArray()); } #endregion } } } }
public static SuperEventDetails CreateObject(PayLoad payLoad) { SuperEventDetails superEventDetail = new SuperEventDetails(); foreach (Event _event in payLoad.Data) { if (_event.AdditionalDetails == null) { _event.AdditionalDetails = new AdditionalDetails(); } List <EventDetailHeader> gett = new List <EventDetailHeader>(); var eventDetailHeader = new EventDetailHeader() { EventID = _event.EventID, NextStreamPosition = payLoad.NextStreamPosition, EventTimeStamp = _event.EventTimestamp }; superEventDetail.EventDetailHeaders.Add(eventDetailHeader); switch (_event.ObjectType) { case "SHEET": var sheetDetail = new SheetDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, SourceObjectID = _event.AdditionalDetails.SourceObjectID, SourceGlobaltemplateID = _event.AdditionalDetails.SourceGlobalTemplateID, SourcetemplateID = _event.AdditionalDetails.SourceTemplateID, Source = _event.AdditionalDetails.Source, SourceType = _event.AdditionalDetails.SourceType, SheetName = _event.AdditionalDetails.SheetName, NewName = _event.AdditionalDetails.NewName, OldName = _event.AdditionalDetails.OldName, AccessLevel = _event.AdditionalDetails.AccessLevel, UserIDInitiator = _event.AdditionalDetails.UserID, GroupID = _event.AdditionalDetails.GroupID, WorkSpaceID = _event.AdditionalDetails.WorkSpaceID, OldUserID = _event.AdditionalDetails.OldUserID, OldAccessLevel = _event.AdditionalDetails.OldAccessLevel, NewUserID = _event.AdditionalDetails.NewUserID, NewAccessLevel = _event.AdditionalDetails.NewAccessLevel, RecipientEmail = _event.AdditionalDetails.RecipientEmail, RecipientGroupID = _event.AdditionalDetails.RecipientGroupID, FormatType = _event.AdditionalDetails.FormatType, RowCount = _event.AdditionalDetails.RowCount, IncludeAttachments = _event.AdditionalDetails.IncludeAttachments, IncludeDiscussions = _event.AdditionalDetails.IncludeDiscussions, SourceSheetID = _event.AdditionalDetails.SourceSheetID, DestinationSheetID = _event.AdditionalDetails.DestinationSheetID, RowsMoved = _event.AdditionalDetails.RowsMoved, RowsCopied = _event.AdditionalDetails.RowsCopied, CelllinkSourceSheetID = _event.AdditionalDetails.CelllinkSourceSheetID, NewParentContainerID = _event.AdditionalDetails.NewParentContainerID, ParentContainerID = _event.AdditionalDetails.ParentContainerID, FolderName = _event.AdditionalDetails.FolderName, RequestUserID = _event.AdditionalDetails.RequestUserID, SendCompletionEmail = _event.AdditionalDetails.SendCompletionEmail, UserIDImpacted = _event.AdditionalDetails.UserIDImpacted, EventTimestamp = _event.AdditionalDetails.EventTimeStamp }; superEventDetail.SheetDetails.Add(sheetDetail); break; case "REPORT": var reportDetail = new ReportDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, ReportName = _event.AdditionalDetails.ReportName, SourceObjectID = _event.AdditionalDetails.SourceObjectID, SourceGlobaltemplateID = _event.AdditionalDetails.SourceGlobalTemplateID, SourceType = _event.AdditionalDetails.SourceType, NewName = _event.AdditionalDetails.NewName, OldName = _event.AdditionalDetails.OldName, AccessLevel = _event.AdditionalDetails.AccessLevel, UserID = _event.AdditionalDetails.UserID, GroupID = _event.AdditionalDetails.GroupID, WorkSpaceID = _event.AdditionalDetails.WorkSpaceID, OldUserID = _event.AdditionalDetails.OldUserID, OldAccessLevel = _event.AdditionalDetails.OldAccessLevel, NewUserID = _event.AdditionalDetails.NewUserID, NewAccessLevel = _event.AdditionalDetails.NewAccessLevel, NewParentContainerID = _event.AdditionalDetails.NewParentContainerID, ParentContainerID = _event.AdditionalDetails.ParentContainerID, FolderName = _event.AdditionalDetails.FolderName, RecipientEmail = _event.AdditionalDetails.RecipientEmail, RecipientGroupID = _event.AdditionalDetails.RecipientGroupID, FormatType = _event.AdditionalDetails.FormatType, UserIDImpacted = _event.AdditionalDetails.UserIDImpacted, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source }; superEventDetail.ReportDetails.Add(reportDetail); break; case "ATTACHMENT": var attachmentDetail = new AttachmentDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, SheetID = _event.AdditionalDetails.SheetID, WorkSpaceID = _event.AdditionalDetails.WorkSpaceID, AttachmentName = _event.AdditionalDetails.AttachmentName, MultifileDownloadname = _event.AdditionalDetails.MultifileDownloadName, RecipientEmail = _event.AdditionalDetails.RecipientEmail, RecipientGroupID = _event.AdditionalDetails.RecipientGroupID, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.AttachmentDetails.Add(attachmentDetail); break; case "USER": var userDetail = new UserDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, UserTypes = _event.AdditionalDetails.UserTypes, EmailAddress = _event.AdditionalDetails.EmailAddress, DeclineReason = _event.AdditionalDetails.DeclineReason, OldownerUserID = _event.AdditionalDetails.OldOwnerUserID, NewownerUserID = _event.AdditionalDetails.NewOwnerUserID, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.UserDetails.Add(userDetail); break; case "DISCUSSION": var discussionDetail = new DiscussionDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, SheetRowID = _event.AdditionalDetails.SheetRowID, SheetID = _event.AdditionalDetails.SheetID, WorkSpaceID = _event.AdditionalDetails.WorkSpaceID, RecipientEmail = _event.AdditionalDetails.RecipientEmail, RecipientGroupID = _event.AdditionalDetails.RecipientGroupID, IncludeAttachments = _event.AdditionalDetails.IncludeAttachments, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.DiscussionDetails.Add(discussionDetail); break; case "DASHBOARD": var dashboardDetail = new DashboardDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, DashboardName = _event.AdditionalDetails.DashboardName, SourceGlobalTemplateID = _event.AdditionalDetails.SourceGlobalTemplateID, SourceObjectID = _event.AdditionalDetails.SourceObjectID, SourceType = _event.AdditionalDetails.SourceType, AccessibleBy = _event.AdditionalDetails.AccessibleBy, PublishType = _event.AdditionalDetails.PublishType, PublishFormat = _event.AdditionalDetails.PublishFormat, AccessLevel = _event.AdditionalDetails.AccessLevel, UserID = _event.AdditionalDetails.UserID, GroupID = _event.AdditionalDetails.GroupID, WorkspaceID = _event.AdditionalDetails.WorkSpaceID, OldUserID = _event.AdditionalDetails.OldUserID, OldAccessLevel = _event.AdditionalDetails.OldAccessLevel, NewUserID = _event.AdditionalDetails.NewUserID, NewAccessLevel = _event.AdditionalDetails.NewAccessLevel, NewparentContainerID = _event.AdditionalDetails.NewParentContainerID, ParentContainerID = _event.AdditionalDetails.ParentContainerID, FolderName = _event.AdditionalDetails.FolderName, OldName = _event.AdditionalDetails.OldName, NewName = _event.AdditionalDetails.NewName, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.DashboardDetails.Add(dashboardDetail); break; case "FOLDER": var folderDetail = new FolderDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, FolderName = _event.AdditionalDetails.FolderName, SourceFolderID = _event.AdditionalDetails.SourceFolderID, OldName = _event.AdditionalDetails.OldName, NewName = _event.AdditionalDetails.NewName, SendCompletionEmail = _event.AdditionalDetails.SendCompletionEmail, IncludeAttachments = _event.AdditionalDetails.IncludeAttachments, FormatType = _event.AdditionalDetails.FormatType, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.FolderDetails.Add(folderDetail); break; case "FORM": var formDetail = new FormDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, FormName = _event.AdditionalDetails.FolderName, SheetID = _event.AdditionalDetails.SheetID, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.FormDetails.Add(formDetail); break; case "UPDATE REQUEST": var updateRequestDetail = new UpdateRequestDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, SheetID = _event.AdditionalDetails.SheetID, RowCounts = _event.AdditionalDetails.RowCount.ToString(), IncludeAttachments = _event.AdditionalDetails.IncludeAttachments, IncludeDiscussions = _event.AdditionalDetails.IncludeDiscussions, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.UpdateRequestDetails.Add(updateRequestDetail); break; case "WORKSPACE": var workspaceDetail = new WorkSpaceDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, OldName = _event.AdditionalDetails.OldName, NewName = _event.AdditionalDetails.NewName, AccessLevel = _event.AdditionalDetails.AccessLevel, UserID = _event.AdditionalDetails.UserID, GroupID = _event.AdditionalDetails.GroupID, IncludeAttachments = _event.AdditionalDetails.IncludeAttachments, SendCompletionEmail = _event.AdditionalDetails.SendCompletionEmail, FormatType = _event.AdditionalDetails.FormatType, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.WorkSpaceDetails.Add(workspaceDetail); break; case "ACCESSTOKEN": var accessTokenDetails = new AccessTokenDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, TokenName = _event.AdditionalDetails.TokenName, TokenDisplayValue = _event.AdditionalDetails.TokenDisplayValue, TokenExpirationTimestamp = _event.AdditionalDetails.TokenExpirationTimestamp, AccessScopes = _event.AdditionalDetails.AccessScopes, AppClientID = _event.AdditionalDetails.AppClientID, AppName = _event.AdditionalDetails.AppName, TokenUserID = _event.AdditionalDetails.TokenUserID, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.AccessTokenDetails.Add(accessTokenDetails); break; case "ACCOUNT": var accountDetails = new AccountDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, NewContactUserID = _event.AdditionalDetails.NewContactUserID, OldContactUserID = _event.AdditionalDetails.OldContactUserID, NewName = _event.AdditionalDetails.NewName, OldName = _event.AdditionalDetails.OldName, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.AccountDetails.Add(accountDetails); break; case "GROUP": var groupDetails = new GroupDetails() { EventID = _event.EventID, ObjectID = _event.ObjectID, Action = _event.Action, GroupName = _event.AdditionalDetails.GroupName, OldName = _event.AdditionalDetails.OldName, NewName = _event.AdditionalDetails.NewName, OldownerUserID = _event.AdditionalDetails.OldOwnerUserID, NewownerUserID = _event.AdditionalDetails.NewOwnerUserID, MemberUserID = _event.AdditionalDetails.MemberUserID, UserIDInitiator = _event.UserID, EventTimestamp = _event.EventTimestamp, RequestUserID = _event.RequestUserID, Source = _event.Source, }; superEventDetail.GroupDetails.Add(groupDetails); break; } } return(superEventDetail); }
public void AddSelectedAttachmentDetails(AttachmentDetails attachmentDetails) { _currentAttachmentDetails = attachmentDetails; }
public async void Test_Mail_Attachment() { #region New Code Data //var attachments = new List<AttachmentDetails>(); //AttachmentDetails attachmentDetails = new AttachmentDetails() //{ // attachmentType = "0", // name= "program to modify MARCH2016.docx", // originalName= "program to modify MARCH2016.docx", // isInline= false, // contentType= "application/vnd.openxmlformats-officedocument.wordprocessingml.document", // id= "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAJgRoKAAABEgAQAJ0HuxfoKzZCt0IGCqWvGxE=", // size= 335497 //}; //attachments.Add(attachmentDetails); //var foldePath = new List<string>(); //foldePath.Add("/sites/microsoft/12e53e87cbc16d97763d4e87f1fbb8f9/Emails"); //var serviceRequestVM = new ServiceRequest() //{ // AllowContentCheck = true, // AttachmentToken = "", // Attachments = attachments, // EwsUrl = new System.Uri("https://outlook.office365.com/EWS/Exchange.asmx"), // DocumentLibraryName = "testerV123", // FolderPath = foldePath, // MailId = "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAJgRoKAAA=", // PerformContentCheck = false, // Overwrite = false, // Subject = "Test attachments.eml" //}; //var matterClient = new Client() //{ // Url = "https://msmatter.sharepoint.com/sites/microsoft" //}; //var attachmentRequestVM = new AttachmentRequestVM() //{ // ServiceRequest = serviceRequestVM, // Client = matterClient //}; #endregion #region Old Code Data var attachments = new List <AttachmentDetails>(); AttachmentDetails attachmentDetails = new AttachmentDetails() { attachmentType = "0", name = "program to modify MARCH2016.docx", isInline = false, contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", id = "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAJgRoKAAABEgAQAJ0HuxfoKzZCt0IGCqWvGxE=", size = 335497 }; attachments.Add(attachmentDetails); var foldePath = new List <string>(); foldePath.Add("/sites/microsoft/12e53e87cbc16d97763d4e87f1fbb8f9/Emails"); var serviceRequestVM = new ServiceRequest() { AllowContentCheck = true, AttachmentToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkkzTDVfM3pTRVZPT3RmQmZFTGpXRmMwaFNwWSJ9.eyJpc3MiOiIwMDAwMDAwMi0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDBAM2M0NTYyY2EtMzlhNC00ZDhiLTkxZmYtNmQzZWVmYWI1YzFkIiwiYXVkIjoiMDAwMDAwMDItMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL291dGxvb2sub2ZmaWNlMzY1LmNvbUAzYzQ1NjJjYS0zOWE0LTRkOGItOTFmZi02ZDNlZWZhYjVjMWQiLCJuYmYiOjE0NjM0NDEwMjIsImV4cCI6MTQ2MzQ0MTMyMiwibmFtZWlkIjoiMTA3OGNjMjQtZTg5Yy00OGY4LWFmYTEtY2IzMzIxNjM2OTY2QDNjNDU2MmNhLTM5YTQtNGQ4Yi05MWZmLTZkM2VlZmFiNWMxZCIsInZlciI6IkV4Y2hhbmdlLkNhbGxiYWNrLlYxIiwiYXBwY3R4c2VuZGVyIjoiaHR0cHM6Ly9tYXR0ZXJ3ZWJhcHAuYXp1cmV3ZWJzaXRlcy5uZXRAM2M0NTYyY2EtMzlhNC00ZDhiLTkxZmYtNmQzZWVmYWI1YzFkIiwiYXBwY3R4Ijoie1wib2lkXCI6XCI5MzNjZTFmZC0yNjkzLTRhYWUtYjdiYS0yYTBiNjhlNDEwMjlcIixcInB1aWRcIjpcIjEwMDNCRkZEOTc3QTM4REJcIixcInNtdHBcIjpcIm1hdHRlcmFkbWluQE1TbWF0dGVyLm9ubWljcm9zb2Z0LmNvbVwiLFwidXBuXCI6XCJtYXR0ZXJhZG1pbkBNU21hdHRlci5vbm1pY3Jvc29mdC5jb21cIixcInNjb3BlXCI6XCJQYXJlbnRJdGVtSWQ6QUFNa0FERm1NemhoTm1RMkxXRm1ZVFF0TkdFM1lTMWhPRGRpTFdRMk5HTXlOVGcwT0dZNVpnQkdBQUFBQUFBZlRVcEdlVzlZUTR1YzUzcVJjV3VvQndDdGc3ZFJGcGFZVHI3bm91RXBXK2M2QUFBQUFBRU1BQUN0ZzdkUkZwYVlUcjdub3VFcFcrYzZBQUFKZ1JvS0FBQT1cIn0ifQ.JHVTqrNjDmwaJ2mZyiZ17GkAqILQywSH6Ac2wfH8DcEvIpwAZ_SztjlGlRQ9dysIxEqQxeO5Enb2Lin_jl1490EDGpZ4pN_go9ank5NcIZzxJP8WegjUzhtIcEilGIJuAwXTPXPoA0MUzhQN9JF9fUo5E63GncDzOKKrlvDT1dZmtrBqikvM1llmeOfNWLkGA_2qxjLzWam8gv9PZDTCAF_0TPoy8RaEJ5mwwHFos0KlA5R6__GW5fayS_tt8Y4Wd62Oo1JF-fePErrYa8g_n9fB3J_NsR1pDPtPVXvVYtK4A42iPvkvYwIZjcCDx5f-OPn_QXkY_wTaTpIUOlTPug", Attachments = attachments, EwsUrl = new System.Uri("https://outlook.office365.com/EWS/Exchange.asmx"), DocumentLibraryName = "testerV123", FolderPath = foldePath, MailId = "AAMkADFmMzhhNmQ2LWFmYTQtNGE3YS1hODdiLWQ2NGMyNTg0OGY5ZgBGAAAAAAAfTUpGeW9YQ4uc53qRcWuoBwCtg7dRFpaYTr7nouEpW+c6AAAAAAEMAACtg7dRFpaYTr7nouEpW+c6AAAJgRoKAAA=", PerformContentCheck = false, Overwrite = false, Subject = "Test attachments.eml" }; var matterClient = new Client() { Url = "https://msmatter.sharepoint.com/sites/microsoft" }; var attachmentRequestVM = new AttachmentRequestVM() { ServiceRequest = serviceRequestVM, Client = matterClient }; #endregion using (var client = testServer.CreateClient().AcceptJson()) { var response = await client.PostAsJsonAsync("http://localhost:44323/api/v1/document/uploadmail", attachmentRequestVM); var result = response.Content.ReadAsStringAsync().Result; Assert.NotNull(result); } }