Exemplo n.º 1
0
		private void UpdateProxyForSendLink(IProxy mailItem, string message, List<SendLinkInfo> uploadedFiles, string id)
		{
			mailItem.SetLinkMessage(message);

			foreach (SendLinkInfo sli in uploadedFiles)
			{
				if (0 != mailItem.ContainsAttachment(sli.ContentId))
				{
					//Update existing
					global::Interop.Workshare.Client.NotesProxy.Attachment proxyAttachment = mailItem.GetAttachmentById(sli.ContentId);
					proxyAttachment.SetLink(string.IsNullOrEmpty(sli.Link) ? "" : sli.Link);
					proxyAttachment.SetProcessStatus(AttachmentProcessStatus.ProcessStatus_ReplaceWithLink);
					
					// The displayname of the first item can change if there is a single link for the collection
					proxyAttachment.SetDisplayName(string.IsNullOrEmpty(sli.DisplayName) ? "" : sli.DisplayName);
				}
			}

			if (ShouldAttachSendLinkContentFile())
			{
				SendLinkInfo sli = CreateSendLinkContentFile(uploadedFiles, id);
				global::Interop.Workshare.Client.NotesProxy.Attachment proxyAttachment = new global::Interop.Workshare.Client.NotesProxy.Attachment();
				proxyAttachment.SetFileName(sli.FilePath);
				proxyAttachment.SetDisplayName(sli.DisplayName);
				proxyAttachment.SetProcessStatus(AttachmentProcessStatus.ProcessStatus_New);
				proxyAttachment.SetContentId(Guid.NewGuid().ToString("B")); //B = 32 digits separated by hyphens, enclosed in brace
				proxyAttachment.SetContentItemIndex(-1); // -1 = At end of message
				mailItem.AddAttachment(proxyAttachment);
			}
		}