Example #1
0
		public bool Replace(string fileName, OOMAttachment iattachment)
		{
			OOMAttachment attachment = iattachment;
			if (attachment != null)
			{
				AttachmentProperties aprops = attachment.AttachProperties;
				string displayName = attachment.DisplayName;
				RemoveAttachment(attachment);
				AddAttachment(fileName, displayName, aprops);
				return true;
			}

			return false;
		}
Example #2
0
		private void RemoveAttachment(OOMAttachment attachment)
		{
			string recordkey = attachment.AttachProperties.RecordKey;

			for (int index = _mailItem.Attachments.Count; index > 0; --index)
			{
				dynamic data = _mailItem.Attachments[index].PropertyAccessor.GetProperty(MAPIStringDefines.PR_RECORD_KEY);
				if (data == null)
				{
					continue;
				}

				if (recordkey == Utilities.GetStringFromBytes(data))
				{
					_mailItem.Attachments.Remove(index);
					_mailItem.Save();
					break;
				}
			}
		}