-
sqrtZeroKnowledge committed 1 year ago
Showing first 38 files as there are too many
-
1 + // 2 + // Address.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using MsgKit.Enums; 29 + using MsgKit.Structures; 30 + 31 + namespace MsgKit 32 + { 33 + /// <summary> 34 + /// A base class for <see cref="Sender"/>, <see cref="Recipient"/>, <see cref="Receiving"/> 35 + /// and <see cref="Representing"/> 36 + /// </summary> 37 + public class Address 38 + { 39 + #region Fields 40 + /// <summary> 41 + /// The messaging user's e-mail address type 42 + /// </summary> 43 + private AddressType _addressType; 44 + #endregion 45 + 46 + #region Properties 47 + /// <summary> 48 + /// The E-mail address 49 + /// </summary> 50 + public string Email { get; internal set; } 51 + 52 + /// <summary> 53 + /// The displayname for the <see cref="Email"/> 54 + /// </summary> 55 + public string DisplayName { get; internal set; } 56 + 57 + /// <summary> 58 + /// The original displayname for the <see cref="Email"/> 59 + /// </summary> 60 + public string OriginalDisplayName => AddressType == AddressType.Smtp ? Email : DisplayName; 61 + 62 + /// <summary> 63 + /// Returns the messaging user's e-mail address type. Use <see cref="AddressTypeString"/> 64 + /// when this property returns <see cref="Enums.AddressType.Unknown"/> 65 + /// </summary> 66 + public AddressType AddressType 67 + { 68 + get => _addressType; 69 + internal set 70 + { 71 + _addressType = value; 72 + switch (value) 73 + { 74 + case AddressType.Unknown: 75 + AddressTypeString = string.Empty; 76 + break; 77 + 78 + case AddressType.Ex: 79 + AddressTypeString = "EX"; 80 + break; 81 + 82 + case AddressType.Smtp: 83 + AddressTypeString = "SMTP"; 84 + break; 85 + 86 + case AddressType.Fax: 87 + AddressTypeString = "FAX"; 88 + break; 89 + 90 + case AddressType.Mhs: 91 + AddressTypeString = "MHS"; 92 + break; 93 + 94 + case AddressType.Profs: 95 + AddressTypeString = "PROFS"; 96 + break; 97 + 98 + case AddressType.X400: 99 + AddressTypeString = "X400"; 100 + break; 101 + 102 + default: 103 + throw new ArgumentOutOfRangeException(nameof(value), value, null); 104 + } 105 + } 106 + } 107 + 108 + /// <summary> 109 + /// Returns the <see cref="Enums.AddressType"/> as a string 110 + /// </summary> 111 + public string AddressTypeString { get; private set; } 112 + 113 + /// <summary> 114 + /// <see cref="OneOffEntryId"/> 115 + /// </summary> 116 + internal OneOffEntryId OneOffEntryId => new OneOffEntryId(Email, DisplayName, AddressType); 117 + #endregion 118 + 119 + #region Constructor 120 + /// <summary> 121 + /// Creates this object and sets all it's needed properties 122 + /// </summary> 123 + /// <param name="email">The full E-mail address</param> 124 + /// <param name="displayName">The displayname for the <paramref name="email" /></param> 125 + /// <param name="addressType">The <see cref="AddressType" /></param> 126 + public Address(string email, 127 + string displayName, 128 + AddressType addressType = AddressType.Smtp) 129 + { 130 + Email = email ?? string.Empty; 131 + DisplayName = string.IsNullOrWhiteSpace(displayName) ? email : displayName; 132 + 133 + AddressType = addressType; 134 + } 135 + #endregion 136 + } 137 + } 138 + -
1 + // 2 + // Appointment.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> and Travis Semple 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using MsgKit.Enums; 29 + using OpenMcdf; 30 + 31 + namespace MsgKit 32 + { 33 + /// <summary> 34 + /// Inherits from Email, because it has quite a few of the same fields 35 + /// </summary> 36 + public class Appointment : Email 37 + { 38 + #region Properties 39 + /// <summary> 40 + /// Holds the location for the Appointment 41 + /// </summary> 42 + public string Location { get; set; } 43 + 44 + /// <summary> 45 + /// This property specifies whether or not the event is an all-day event, as 46 + /// specified by the user. A value of <c>true</c> indicates that the event is an all-day 47 + /// event, in which case the start time and end time must be midnight so that the 48 + /// duration is a multiple of 24 hours and is at least 24 hours. A value of <c>false</c> 49 + /// or the absence of this property indicates the event is not an all-day event. The 50 + /// client or server must not infer the value as TRUE when a user happens to create an 51 + /// event that is 24 hours, even if the event starts and ends at midnight. 52 + /// </summary> 53 + public bool AllDay { get; set; } 54 + 55 + /// <summary> 56 + /// Holds meeting information for the appointment 57 + /// </summary> 58 + public DateTime MeetingStart { get; set; } 59 + 60 + /// <summary> 61 + /// The end of the meeting 62 + /// </summary> 63 + public DateTime MeetingEnd { get; set; } 64 + #endregion 65 + 66 + #region Constructors 67 + /// <summary> 68 + /// Sends an appointment with sender, representing, subject, draft. 69 + /// </summary> 70 + /// <param name="sender"> Contains sender name and email. </param> 71 + /// <param name="representing">Contains who this appointment is representing. </param> 72 + /// <param name="subject"> Contains the subject for this appointment. </param> 73 + /// <param name="draft"> Is this a draft?</param> 74 + public Appointment(Sender sender, 75 + Representing representing, 76 + string subject, 77 + bool draft = false) : base(sender, representing, subject, draft) 78 + { 79 + } 80 + 81 + /// <summary> 82 + /// Used to send without the representing structure. 83 + /// </summary> 84 + /// <param name="sender"></param> 85 + /// <param name="subject"></param> 86 + /// <param name="draft"></param> 87 + public Appointment(Sender sender, 88 + string subject, 89 + bool draft = false) : base(sender, subject, draft) 90 + { 91 + } 92 + #endregion 93 + 94 + #region WriteToStorage 95 + /// <summary> 96 + /// Writes all the properties that are part of the <see cref="Appointment"/> object either as <see cref="CFStorage"/>'s 97 + /// or <see cref="CFStream"/>'s to the <see cref="CompoundFile.RootStorage"/> 98 + /// </summary> 99 + private new void WriteToStorage() 100 + { 101 + Class = MessageClass.IPM_Appointment; 102 + NamedProperties.AddProperty(NamedPropertyTags.PidLidLocation, Location); 103 + NamedProperties.AddProperty(NamedPropertyTags.PidLidAppointmentStartWhole, MeetingStart); 104 + NamedProperties.AddProperty(NamedPropertyTags.PidLidAppointmentEndWhole, MeetingEnd); 105 + NamedProperties.AddProperty(NamedPropertyTags.PidLidMeetingType, MeetingType.mtgRequest); 106 + NamedProperties.AddProperty(NamedPropertyTags.PidLidAppointmentSubType, AllDay); 107 + NamedProperties.AddProperty(NamedPropertyTags.PidLidAppointmentStateFlags, AppointmentState.asfMeeting); 108 + NamedProperties.AddProperty(NamedPropertyTags.PidLidReminderFileParameter, PidLidReminderFileParameter); 109 + NamedProperties.AddProperty(NamedPropertyTags.PidLidReminderOverride, PidLidReminderOverride); 110 + } 111 + #endregion 112 + 113 + #region Save 114 + /// <summary> 115 + /// Saves the message to the given <paramref name="stream" /> 116 + /// </summary> 117 + /// <param name="stream"></param> 118 + public new void Save(System.IO.Stream stream) 119 + { 120 + WriteToStorage(); 121 + base.Save(stream); 122 + } 123 + 124 + /// <summary> 125 + /// Saves the message to the given <paramref name="fileName" /> 126 + /// </summary> 127 + /// <param name="fileName"></param> 128 + public new void Save(string fileName) 129 + { 130 + WriteToStorage(); 131 + base.Save(fileName); 132 + } 133 + #endregion 134 + } 135 + } -
1 + // 2 + // Attachments.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using System.Collections.Generic; 29 + using System.IO; 30 + using System.Linq; 31 + using MsgKit.Enums; 32 + using MsgKit.Exceptions; 33 + using MsgKit.Helpers; 34 + using MsgKit.Streams; 35 + using MsgKit.Structures; 36 + using OpenMcdf; 37 + using Stream = System.IO.Stream; 38 + // ReSharper disable UnusedAutoPropertyAccessor.Global 39 + // ReSharper disable MemberCanBePrivate.Global 40 + // ReSharper disable UnusedMember.Global 41 + 42 + namespace MsgKit 43 + { 44 + /// <summary> 45 + /// Contains a list of <see cref="Attachment" /> objects that are added to a <see cref="Message" /> 46 + /// </summary> 47 + /// <remarks> 48 + /// See https://msdn.microsoft.com/en-us/library/office/cc842285.aspx 49 + /// </remarks> 50 + public class Attachments : List<Attachment> 51 + { 52 + #region CheckAttachmentFileName 53 + /// <summary> 54 + /// Checks if the <paramref name="fileName" /> already exists in this object 55 + /// </summary> 56 + /// <param name="fileName"></param> 57 + /// <param name="contentId"></param> 58 + // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local 59 + private void CheckAttachmentFileName(string fileName, string contentId) 60 + { 61 + var file = Path.GetFileName(fileName); 62 + 63 + if (this.Any( 64 + attachment => attachment.FileName.Equals(fileName, StringComparison.InvariantCultureIgnoreCase) 65 + && string.Equals(attachment.ContentId, contentId, StringComparison.InvariantCultureIgnoreCase))) 66 + throw new MKAttachmentExists($"The attachment with the name '{file}' already exists"); 67 + } 68 + #endregion 69 + 70 + #region WriteToStorage 71 + /// <summary> 72 + /// Writes the <see cref="Attachment" /> objects to the given <paramref name="rootStorage" /> 73 + /// and it will set all the needed properties 74 + /// </summary> 75 + /// <param name="rootStorage">The root <see cref="CFStorage" /></param> 76 + /// <returns> 77 + /// Total size of the written <see cref="Attachment"/> objects and it's <see cref="Properties"/> 78 + /// </returns> 79 + internal long WriteToStorage(CFStorage rootStorage) 80 + { 81 + long size = 0; 82 + 83 + for (var index = 0; index < Count; index++) 84 + { 85 + var attachment = this[index]; 86 + var storage = rootStorage.AddStorage(PropertyTags.AttachmentStoragePrefix + index.ToString("X8").ToUpper()); 87 + size += attachment.WriteProperties(storage, index); 88 + } 89 + 90 + return size; 91 + } 92 + #endregion 93 + 94 + #region AddAttachment 95 + /// <summary> 96 + /// Adds an <see cref="Attachment" /> by <see cref="AttachmentType.ATTACH_BY_VALUE" /> (default) 97 + /// </summary> 98 + /// <param name="fileName">The file to add with it's full path</param> 99 + /// <param name="renderingPosition">Indicates how an attachment should be displayed in a rich text message</param> 100 + /// <param name="isInline">Set to true to add the attachment inline</param> 101 + /// <param name="contentId">The id for the inline attachment when <paramref name="isInline" /> is set to true</param> 102 + /// <exception cref="FileNotFoundException">Raised when the <paramref name="fileName" /> could not be found</exception> 103 + /// <exception cref="MKAttachmentExists">Raised when an attachment with the same name already exists</exception> 104 + /// <exception cref="ArgumentNullException"> 105 + /// Raised when <paramref name="isInline" /> is set to true and 106 + /// <paramref name="contentId" /> is null, white space or empty 107 + /// </exception> 108 + public void Add(string fileName, 109 + long renderingPosition = -1, 110 + bool isInline = false, 111 + string contentId = "") 112 + { 113 + if (Count >= 2048) 114 + throw new MKAttachment("To many attachments, an msg file can have a maximum of 2048 attachment"); 115 + 116 + CheckAttachmentFileName(fileName, contentId); 117 + var file = new FileInfo(fileName); 118 + var stream = file.OpenRead(); 119 + 120 + Add(new Attachment(stream, 121 + file.Name, 122 + file.CreationTime, 123 + file.LastWriteTime, 124 + AttachmentType.ATTACH_BY_VALUE, 125 + renderingPosition, 126 + isInline, 127 + contentId)); 128 + } 129 + 130 + /// <summary> 131 + /// Adds an <see cref="Attachment" /> stream by <see cref="AttachmentType.ATTACH_BY_VALUE" /> (default) 132 + /// </summary> 133 + /// <param name="stream">The stream to the attachment</param> 134 + /// <param name="fileName">The name for the attachment</param> 135 + /// <param name="renderingPosition">Indicates how an attachment should be displayed in a rich text message</param> 136 + /// <param name="isInline">Set to true to add the attachment inline</param> 137 + /// <param name="contentId">The id for the inline attachment when <paramref name="isInline" /> is set to true</param> 138 + /// <exception cref="ArgumentNullException">Raised when the stream is null</exception> 139 + /// <exception cref="MKAttachmentExists">Raised when an attachment with the same name already exists</exception> 140 + /// <exception cref="ArgumentNullException"> 141 + /// Raised when <paramref name="isInline" /> is set to true and 142 + /// <paramref name="contentId" /> is null, white space or empty 143 + /// </exception> 144 + public void Add(Stream stream, 145 + string fileName, 146 + long renderingPosition = -1, 147 + bool isInline = false, 148 + string contentId = "") 149 + { 150 + if (Count >= 2048) 151 + throw new MKAttachment("To many attachments, an msg file can have a maximum of 2048 attachment"); 152 + 153 + if (stream == null) 154 + throw new ArgumentNullException(nameof(stream)); 155 + 156 + CheckAttachmentFileName(fileName, contentId); 157 + var dateTime = DateTime.Now; 158 + 159 + Add(new Attachment(stream, 160 + fileName, 161 + dateTime, 162 + dateTime, 163 + AttachmentType.ATTACH_BY_VALUE, 164 + renderingPosition, 165 + isInline, 166 + contentId)); 167 + } 168 + 169 + /// <summary> 170 + /// Adds an <see cref="Attachment" /> stream by <see cref="AttachmentType.ATTACH_BY_VALUE" /> (default) 171 + /// </summary> 172 + /// <param name="stream">The stream to the attachment</param> 173 + /// <param name="fileName">The name for the attachment</param> 174 + /// <exception cref="ArgumentNullException">Raised when the stream is null</exception> 175 + /// <exception cref="MKAttachmentExists">Raised when an attachment with the same name already exists</exception> 176 + internal void AddContactPhoto(Stream stream, string fileName) 177 + { 178 + if (stream == null) 179 + throw new ArgumentNullException(nameof(stream)); 180 + 181 + var dateTime = DateTime.Now; 182 + 183 + Add(new Attachment(stream, 184 + fileName, 185 + dateTime, 186 + dateTime, 187 + AttachmentType.ATTACH_BY_VALUE, 188 + -1, 189 + false, 190 + string.Empty, 191 + true)); 192 + } 193 + 194 + #endregion 195 + 196 + #region AddLink 197 + /// <summary> 198 + /// Adds an <see cref="Attachment" /> by <see cref="AttachmentType.ATTACH_BY_REF_ONLY" /> as a link 199 + /// </summary> 200 + /// <param name="file">The <see cref="FileInfo"/></param> 201 + /// <param name="renderingPosition">Indicates how an attachment should be displayed in a rich text message</param> 202 + /// <param name="isInline">Set to true to add the attachment inline</param> 203 + /// <param name="contentId">The id for the inline attachment when <paramref name="isInline" /> is set to true</param> 204 + /// <exception cref="FileNotFoundException">Raised when the <paramref name="file" /> could not be found</exception> 205 + /// <exception cref="MKAttachmentExists">Raised when an attachment with the same name already exists</exception> 206 + /// <exception cref="ArgumentNullException"> 207 + /// Raised when <paramref name="isInline" /> is set to true and 208 + /// <paramref name="contentId" /> is null, white space or empty 209 + /// </exception> 210 + /// <remarks> 211 + /// Universal naming convention (UNC) names are recommended for fully-qualified paths, which should be used with 212 + /// <see cref="AttachmentType.ATTACH_BY_REF_ONLY" />. 213 + /// </remarks> 214 + public void AddLink(FileInfo file, 215 + long renderingPosition = -1, 216 + bool isInline = false, 217 + string contentId = "") 218 + { 219 + CheckAttachmentFileName(file.Name, contentId); 220 + 221 + Add(new Attachment( 222 + file, 223 + AttachmentType.ATTACH_BY_REF_ONLY, 224 + renderingPosition, 225 + isInline, 226 + contentId)); 227 + } 228 + #endregion 229 + } 230 + 231 + /// <summary> 232 + /// This class represents an attachment 233 + /// </summary> 234 + public class Attachment 235 + { 236 + #region Fields 237 + private readonly FileInfo _file; 238 + #endregion 239 + 240 + #region Properties 241 + /// <summary> 242 + /// The stream to the attachment 243 + /// </summary> 244 + public Stream Stream { get; } 245 + 246 + /// <summary> 247 + /// The filename of the attachment 248 + /// </summary> 249 + public string FileName { get; } 250 + 251 + /// <summary> 252 + /// The <see cref="AttachmentType"/> 253 + /// </summary> 254 + public AttachmentType Type { get; } 255 + 256 + /// <summary> 257 + /// Indicates how an attachment should be displayed in a rich text message. It can be set to an 258 + /// offset in characters, with the first character of the message content as stored in the <see cref="PropertyTags.PR_BODY_W" /> 259 + /// (PidTagBody) property being offset 0, or to -1 (0xFFFFFFFF), indicating that the attachment should 260 + /// not be rendered within the message text at all. 261 + /// </summary> 262 + public long RenderingPosition { get; } 263 + 264 + /// <summary> 265 + /// True when the attachment is inline 266 + /// </summary> 267 + public bool IsInline { get; } 268 + 269 + /// <summary> 270 + /// The content id for an inline attachment 271 + /// </summary> 272 + public string ContentId { get; } 273 + 274 + /// <summary> 275 + /// Returns <c>true</c> when the attachment is a contact photo 276 + /// </summary> 277 + /// <remarks> 278 + /// Only valid when the message is a contact card, otherwise always <c>false</c> 279 + /// </remarks> 280 + public bool IsContactPhoto { get; } 281 + 282 + /// <summary> 283 + /// The date and time when the attachment was created 284 + /// </summary> 285 + public DateTime CreationTime { get; } 286 + 287 + /// <summary> 288 + /// The date and time when the attachment was last modified 289 + /// </summary> 290 + public DateTime LastModificationTime { get; } 291 + #endregion 292 + 293 + #region Constructor 294 + /// <summary> 295 + /// Creates a new attachment object and sets all its properties 296 + /// </summary> 297 + /// <param name="stream">The stream to the attachment</param> 298 + /// <param name="fileName">The attachment filename with it's full path</param> 299 + /// <param name="creationTime">The date and time when the attachment was created</param> 300 + /// <param name="lastModificationTime">The date and time when the attachment was last modified</param> 301 + /// <param name="type">The <see cref="AttachmentType"/></param> 302 + /// <param name="renderingPosition">Indicates how an attachment should be displayed in a rich text message</param> 303 + /// <param name="isInline">True when the attachment is inline</param> 304 + /// <param name="contentId">The id for the attachment when <paramref name="isInline" /> is set to true</param> 305 + /// <param name="isContactPhoto">Set to <c>true</c> when the attachment is a contact photo</param> 306 + /// <exception cref="ArgumentNullException"> 307 + /// Raised when <paramref name="isInline" /> is set to true and 308 + /// <paramref name="contentId" /> is null, white space or empty 309 + /// </exception> 310 + internal Attachment(Stream stream, 311 + string fileName, 312 + DateTime creationTime, 313 + DateTime lastModificationTime, 314 + AttachmentType type = AttachmentType.ATTACH_BY_VALUE, 315 + long renderingPosition = -1, 316 + bool isInline = false, 317 + string contentId = "", 318 + bool isContactPhoto = false) 319 + { 320 + Stream = stream; 321 + FileName = Path.GetFileName(fileName); 322 + CreationTime = creationTime; 323 + LastModificationTime = lastModificationTime; 324 + Type = type; 325 + RenderingPosition = renderingPosition; 326 + IsInline = isInline; 327 + ContentId = contentId; 328 + IsContactPhoto = isContactPhoto; 329 + 330 + if (isInline && string.IsNullOrWhiteSpace(contentId)) 331 + throw new ArgumentNullException(nameof(contentId), "The content id cannot be empty when isInline is set to true"); 332 + } 333 + 334 + /// <summary> 335 + /// Creates a new attachment object and sets all its properties 336 + /// </summary> 337 + /// <param name="file">The <see cref="FileInfo"/></param> 338 + /// <param name="type">The <see cref="AttachmentType"/></param> 339 + /// <param name="renderingPosition">Indicates how an attachment should be displayed in a rich text message</param> 340 + /// <param name="isInline">True when the attachment is inline</param> 341 + /// <param name="contentId">The id for the attachment when <paramref name="isInline" /> is set to true</param> 342 + /// <param name="isContactPhoto">Set to <c>true</c> when the attachment is a contact photo</param> 343 + /// <exception cref="ArgumentNullException"> 344 + /// Raised when <paramref name="isInline" /> is set to true and 345 + /// <paramref name="contentId" /> is null, white space or empty 346 + /// </exception> 347 + internal Attachment(FileInfo file, 348 + AttachmentType type = AttachmentType.ATTACH_BY_VALUE, 349 + long renderingPosition = -1, 350 + bool isInline = false, 351 + string contentId = "", 352 + bool isContactPhoto = false) 353 + { 354 + _file = file; 355 + Stream = file.OpenRead(); 356 + FileName = file.Name; 357 + CreationTime = file.CreationTime; 358 + LastModificationTime = file.LastWriteTime; 359 + Type = type; 360 + RenderingPosition = renderingPosition; 361 + IsInline = isInline; 362 + ContentId = contentId; 363 + IsContactPhoto = isContactPhoto; 364 + 365 + if (isInline && string.IsNullOrWhiteSpace(contentId)) 366 + throw new ArgumentNullException(nameof(contentId), "The content id cannot be empty when isInline is set to true"); 367 + } 368 + #endregion 369 + 370 + #region GetShortFileName 371 + /// <summary> 372 + /// This method will convert a long filename to a short dos 8.3 one 373 + /// </summary> 374 + /// <param name="fileName">The long filename</param> 375 + /// <returns></returns> 376 + private static string GetShortFileName(string fileName) 377 + { 378 + var name = Path.GetFileNameWithoutExtension(fileName); 379 + var extension = Path.GetExtension(fileName); 380 + 381 + if (name != null) 382 + name = (name.Length > 8 ? name.Substring(0, 6) + "~1" : name).ToUpperInvariant(); 383 + 384 + if (extension != null) 385 + name += "." + 386 + (extension.Length > 3 ? extension.Substring(1, 3) : extension.TrimStart('.')).ToUpperInvariant(); 387 + 388 + return name; 389 + } 390 + #endregion 391 + 392 + #region WriteProperties 393 + /// <summary> 394 + /// Writes all the string and binary <see cref="Property">properties</see> as a <see cref="CFStream" /> to the 395 + /// given <paramref name="storage" /> 396 + /// </summary> 397 + /// <param name="storage">The <see cref="CFStorage" /></param> 398 + /// <param name="index">The <see cref="Attachment"/> index</param> 399 + /// <returns> 400 + /// Total size of the written <see cref="Attachment"/> object and it's <see cref="Properties"/> 401 + /// </returns> 402 + internal long WriteProperties(CFStorage storage, int index) 403 + { 404 + var propertiesStream = new AttachmentProperties(); 405 + 406 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_NUM, index, PropertyFlags.PROPATTR_READABLE); 407 + propertiesStream.AddProperty(PropertyTags.PR_INSTANCE_KEY, Mapi.GenerateInstanceKey(), PropertyFlags.PROPATTR_READABLE); 408 + propertiesStream.AddProperty(PropertyTags.PR_RECORD_KEY, Mapi.GenerateRecordKey(), PropertyFlags.PROPATTR_READABLE); 409 + propertiesStream.AddProperty(PropertyTags.PR_RENDERING_POSITION, RenderingPosition, PropertyFlags.PROPATTR_READABLE); 410 + propertiesStream.AddProperty(PropertyTags.PR_OBJECT_TYPE, MapiObjectType.MAPI_ATTACH); 411 + 412 + if (IsContactPhoto) 413 + propertiesStream.AddProperty(PropertyTags.PR_ATTACHMENT_CONTACTPHOTO, true, PropertyFlags.PROPATTR_READABLE); 414 + 415 + if (!string.IsNullOrEmpty(FileName)) 416 + { 417 + propertiesStream.AddProperty(PropertyTags.PR_DISPLAY_NAME_W, FileName); 418 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_FILENAME_W, GetShortFileName(FileName)); 419 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_LONG_FILENAME_W, FileName); 420 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_EXTENSION_W, Path.GetExtension(FileName)); 421 + 422 + if (!string.IsNullOrEmpty(ContentId)) 423 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_CONTENT_ID_W, ContentId); 424 + 425 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_MIME_TAG_W, MimeTypes.GetMimeType(FileName)); 426 + } 427 + 428 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_METHOD, Type); 429 + 430 + switch (Type) 431 + { 432 + case AttachmentType.ATTACH_BY_VALUE: 433 + case AttachmentType.ATTACH_EMBEDDED_MSG: 434 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_DATA_BIN, Stream.ToByteArray()); 435 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_SIZE, Stream.Length); 436 + break; 437 + 438 + case AttachmentType.ATTACH_BY_REF_ONLY: 439 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_DATA_BIN, new byte[0]); 440 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_SIZE, _file.Length); 441 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_LONG_PATHNAME_W, _file.FullName); 442 + break; 443 + 444 + //case AttachmentType.ATTACH_EMBEDDED_MSG: 445 + // var msgStorage = storage.AddStorage(PropertyTags.PR_ATTACH_DATA_BIN.Name); 446 + // var cf = new CompoundFile(Stream); 447 + // Storage.Copy(cf.RootStorage, msgStorage); 448 + // propertiesStream.AddProperty(PropertyTags.PR_ATTACH_SIZE, Stream.Length); 449 + // propertiesStream.AddProperty(PropertyTags.PR_ATTACH_ENCODING, 0); 450 + // break; 451 + 452 + case AttachmentType.ATTACH_BY_REFERENCE: 453 + case AttachmentType.ATTACH_BY_REF_RESOLVE: 454 + case AttachmentType.NO_ATTACHMENT: 455 + case AttachmentType.ATTACH_OLE: 456 + throw new NotSupportedException("AttachByReference, AttachByRefResolve, NoAttachment and AttachOle are not supported"); 457 + } 458 + 459 + if (IsInline) 460 + { 461 + propertiesStream.AddProperty(PropertyTags.PR_ATTACHMENT_HIDDEN, true); 462 + propertiesStream.AddProperty(PropertyTags.PR_ATTACH_FLAGS, AttachmentFlags.ATT_MHTML_REF); 463 + } 464 + 465 + var utcNow = DateTime.UtcNow; 466 + propertiesStream.AddProperty(PropertyTags.PR_CREATION_TIME, utcNow); 467 + propertiesStream.AddProperty(PropertyTags.PR_LAST_MODIFICATION_TIME, utcNow); 468 + propertiesStream.AddProperty(PropertyTags.PR_STORE_SUPPORT_MASK, StoreSupportMaskConst.StoreSupportMask, PropertyFlags.PROPATTR_READABLE); 469 + 470 + return propertiesStream.WriteProperties(storage); 471 + } 472 + #endregion 473 + } 474 + } -
1 + // 2 + // Contact.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> and Travis Semple 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using System.Collections.Generic; 29 + using System.IO; 30 + using System.Linq; 31 + using MsgKit.Enums; 32 + using OpenMcdf; 33 + // ReSharper disable MemberCanBePrivate.Global 34 + // ReSharper disable UnusedAutoPropertyAccessor.Global 35 + 36 + namespace MsgKit 37 + { 38 + /// <summary> 39 + /// A class used to make a new Outlook contact MSG file 40 + /// </summary> 41 + public class Contact : Email 42 + { 43 + #region Properties 44 + /// <summary> 45 + /// The contact image, this needs to be an JPG file 46 + /// </summary> 47 + public byte[] ContactPicture { get; set; } 48 + 49 + /// <summary> 50 + /// File the contact card as ... 51 + /// </summary> 52 + public string FileUnder { get; set; } 53 + 54 + /// <summary> 55 + /// The instant messaging address 56 + /// </summary> 57 + public string InstantMessagingAddress { get; set; } 58 + 59 + /// <summary> 60 + /// Indicates whether the end-user wants this message object hidden from other users who have access to the message object 61 + /// </summary> 62 + public bool Private { get; set; } 63 + 64 + /// <summary> 65 + /// The birth day 66 + /// </summary> 67 + public DateTime? BirthDay { get; set; } 68 + 69 + /// <summary> 70 + /// Specifies the wedding anniversary 71 + /// </summary> 72 + public DateTime? WeddingAnniversary { get; set; } 73 + 74 + /// <summary> 75 + /// Information about the assistant 76 + /// </summary> 77 + public ContactAssistant Assistant { get; set; } 78 + 79 + /// <summary> 80 + /// Contains a telephone number that the message recipient can use to reach the sender 81 + /// </summary> 82 + public string CallBackTelePhoneNumber { get; set; } 83 + 84 + /// <summary> 85 + /// Contains the recipient's car telephone number 86 + /// </summary> 87 + public string CarTelePhoneNumber { get; set; } 88 + 89 + /// <summary> 90 + /// The names of the childrens 91 + /// </summary> 92 + public List<string> ChildrensNames { get; set; } 93 + 94 + /// <summary> 95 + /// The company's main info 96 + /// </summary> 97 + public ContactCompanyMain CompanyMain { get; set; } 98 + 99 + /// <summary> 100 + /// The department name 101 + /// </summary> 102 + public string DepartmentName { get; set; } 103 + 104 + /// <summary> 105 + /// Contains a generational abbreviation that follows the full name of the recipient 106 + /// </summary> 107 + public string Generation { get; set; } 108 + 109 + /// <summary> 110 + /// ontains the first or given name of the recipient 111 + /// </summary> 112 + public string GivenName { get; set; } 113 + 114 + /// <summary> 115 + /// Contains the initials for parts of the full name of the recipient 116 + /// </summary> 117 + public string Initials { get;set; } 118 + 119 + /// <summary> 120 + /// Contains the recipient's ISDN-capable telephone number 121 + /// </summary> 122 + // ReSharper disable once InconsistentNaming 123 + public string ISDNNumber { get; set; } 124 + 125 + /// <summary> 126 + /// Contains a value that indicates the language in which the messaging user is writing messages 127 + /// </summary> 128 + public string Language { get; set; } 129 + 130 + /// <summary> 131 + /// Contains the location of the recipient in a format that is useful to the recipient's organization. 132 + /// </summary> 133 + public string Location { get; set; } 134 + 135 + /// <summary> 136 + /// Contains the name of the recipient's manager 137 + /// </summary> 138 + public string ManagerName { get; set; } 139 + 140 + /// <summary> 141 + /// Contains the middle name of a contact 142 + /// </summary> 143 + public string MiddleName { get; set; } 144 + 145 + /// <summary> 146 + /// Contains the recipient's cellular telephone number 147 + /// </summary> 148 + public string MobileTelephoneNumber { get; set; } 149 + 150 + /// <summary> 151 + /// Contains the nickname of the contact 152 + /// </summary> 153 + public string NickName { get; set; } 154 + 155 + /// <summary> 156 + /// Contains the recipient's office location 157 + /// </summary> 158 + public string OfficeLocation { get; set; } 159 + 160 + /// <summary> 161 + /// Contains the recipient's office location 162 + /// </summary> 163 + public string OfficeTelephoneNumber { get; set; } 164 + 165 + /// <summary> 166 + /// Contains the URL of a user's personal home page 167 + /// </summary> 168 + public string PersonalHomePage { get;set; } 169 + 170 + /// <summary> 171 + /// Contains the recipient's postal address 172 + /// </summary> 173 + public string PostalAddress { get; set; } 174 + 175 + /// <summary> 176 + /// Contains the telephone number of the recipient's primary fax machine 177 + /// </summary> 178 + public string PrimaryFaxNumber { get; set; } 179 + 180 + /// <summary> 181 + /// Contains the recipient's primary telephone number 182 + /// </summary> 183 + public string PrimaryTelephoneNumber { get; set; } 184 + 185 + /// <summary> 186 + /// Contains the profession of the user 187 + /// </summary> 188 + public string Profession { get; set; } 189 + 190 + /// <summary> 191 + /// Contains the recipient's radio telephone number 192 + /// </summary> 193 + public string RadioTelephoneNumber { get; set; } 194 + 195 + /// <summary> 196 + /// Contains the user's spouse name 197 + /// </summary> 198 + public string SpouseName { get; set; } 199 + 200 + /// <summary> 201 + /// Contains the last or surname of the recipient 202 + /// </summary> 203 + public string SurName { get; set; } 204 + 205 + /// <summary> 206 + /// Contains the recipient's telex number 207 + /// </summary> 208 + public string TelexNumber { get; set; } 209 + 210 + /// <summary> 211 + /// Contains the recipient's job title 212 + /// </summary> 213 + public string Title { get; set; } 214 + 215 + /// <summary> 216 + /// Contains the telephone number for the contact's text telephone (TTY) or telecommunication device for the deaf (TDD) 217 + /// </summary> 218 + // ReSharper disable once InconsistentNaming 219 + public string TTYTDDPhoneNumber { get; set; } 220 + 221 + /// <summary> 222 + /// Contains the recipient's pager telephone number 223 + /// </summary> 224 + public string PagerTelephoneNumber { get; set; } 225 + 226 + /// <summary> 227 + /// E-mail address 1 228 + /// </summary> 229 + public Address Email1 { get; set; } 230 + 231 + /// <summary> 232 + /// E-mail address 2 233 + /// </summary> 234 + public Address Email2 { get; set; } 235 + 236 + /// <summary> 237 + /// E-mail address 3 238 + /// </summary> 239 + public Address Email3 { get; set; } 240 + 241 + ///// <summary> 242 + ///// Fax 1 243 + ///// </summary> 244 + //public string Fax1 { get; set; } 245 + 246 + ///// <summary> 247 + ///// Fax 2 248 + ///// </summary> 249 + //public string Fax2 { get; set; } 250 + 251 + ///// <summary> 252 + ///// Fax 3 253 + ///// </summary> 254 + //public string Fax3 { get; set; } 255 + 256 + /// <summary> 257 + /// Yomi name and Yomi company name are fields for entering the phonetic equivalent for Japanese names. 258 + /// In Japan, there is commonly a Furigana equivalent for the Kanji name that is used for sorting and searching. 259 + /// </summary> 260 + public ContactYomi Yomi { get; set; } 261 + 262 + /// <summary> 263 + /// The work details 264 + /// </summary> 265 + public ContactWork Work { get; set; } 266 + 267 + /// <summary> 268 + /// The business details 269 + /// </summary> 270 + public ContactBusiness Business { get; set; } 271 + 272 + /// <summary> 273 + /// The home details 274 + /// </summary> 275 + public ContactHome Home { get; set; } 276 + 277 + /// <summary> 278 + /// The other address 279 + /// </summary> 280 + public ContactOther Other{ get; set; } 281 + 282 + /// <summary> 283 + /// Specifies which physical address is the contact's mailing address 284 + /// </summary> 285 + public PostalAddressId PostalAddressId { get; set; } 286 + #endregion 287 + 288 + #region Constructors 289 + /// <summary> 290 + /// Creates this object and sets all the needed properties 291 + /// </summary> 292 + /// <param name="sender">The <see cref="Email.Sender"/> of the E-mail</param> 293 + /// <param name="representing">The <see cref="MsgKit.Representing"/> sender of the E-mail</param> 294 + /// <param name="subject">The subject of the E-mail</param> 295 + /// <param name="draft">Set to <c>true</c> to save the E-mail as a draft message</param> 296 + /// <param name="readReceipt">Set to <c>true</c> to request a read receipt for the E-mail</param> 297 + public Contact( 298 + Sender sender, 299 + Representing representing, 300 + string subject, 301 + bool draft = false, 302 + bool readReceipt = false) : base(sender, representing, subject, draft, readReceipt) 303 + { 304 + } 305 + 306 + /// <summary> 307 + /// Creates this object and sets all the needed properties 308 + /// </summary> 309 + /// <param name="sender">The <see cref="Email.Sender"/> of the E-mail</param> 310 + /// <param name="subject">The subject of the E-mail</param> 311 + /// <param name="draft">Set to <c>true</c> to save the E-mail as a draft message</param> 312 + /// <param name="readReceipt">Set to <c>true</c> to request a read receipt for the E-mail</param> 313 + public Contact( 314 + Sender sender, 315 + string subject, 316 + bool draft = false, 317 + bool readReceipt = false) : base(sender, subject, draft, readReceipt) 318 + { 319 + } 320 + #endregion 321 + 322 + #region WriteToStorage 323 + /// <summary> 324 + /// Writes all the properties that are part of the <see cref="Appointment"/> object either as <see cref="CFStorage"/>'s 325 + /// or <see cref="CFStream"/>'s to the <see cref="CompoundFile.RootStorage"/> 326 + /// </summary> 327 + private new void WriteToStorage() 328 + { 329 + Class = MessageClass.IPM_Contact; 330 + 331 + if (ContactPicture != null) 332 + { 333 + var memoryStream = new MemoryStream(ContactPicture); 334 + Attachments.AddContactPhoto(memoryStream, "ContactPicture.jpg"); 335 + NamedProperties.AddProperty(NamedPropertyTags.PidLidHasPicture, true); 336 + NamedProperties.AddProperty(NamedPropertyTags.PidLidSmartNoAttach, true); 337 + } 338 + else 339 + NamedProperties.AddProperty(NamedPropertyTags.PidLidHasPicture, false); 340 + 341 + if (!string.IsNullOrWhiteSpace(FileUnder)) 342 + NamedProperties.AddProperty(NamedPropertyTags.PidLidFileUnder, FileUnder); 343 + 344 + if (!string.IsNullOrWhiteSpace(InstantMessagingAddress)) 345 + NamedProperties.AddProperty(NamedPropertyTags.PidLidInstantMessagingAddress, InstantMessagingAddress); 346 + 347 + NamedProperties.AddProperty(NamedPropertyTags.PidLidPrivate, Private); 348 + 349 + if (BirthDay.HasValue) 350 + { 351 + NamedProperties.AddProperty(NamedPropertyTags.PidLidBirthdayLocal, BirthDay); 352 + TopLevelProperties.AddProperty(PropertyTags.PR_BIRTHDAY, BirthDay); 353 + } 354 + 355 + if (WeddingAnniversary.HasValue) 356 + { 357 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWeddingAnniversaryLocal, WeddingAnniversary); 358 + TopLevelProperties.AddProperty(PropertyTags.PR_WEDDING_ANNIVERSARY, WeddingAnniversary); 359 + } 360 + 361 + if (Assistant != null) 362 + { 363 + if (!string.IsNullOrWhiteSpace(Assistant.Name)) 364 + TopLevelProperties.AddProperty(PropertyTags.PR_ASSISTANT_W, Assistant.Name); 365 + 366 + if (!string.IsNullOrWhiteSpace(Assistant.TelephoneNumber)) 367 + TopLevelProperties.AddProperty(PropertyTags.PR_ASSISTANT_TELEPHONE_NUMBER_W, Assistant.TelephoneNumber); 368 + } 369 + 370 + if (!string.IsNullOrWhiteSpace(CallBackTelePhoneNumber)) 371 + TopLevelProperties.AddProperty(PropertyTags.PR_CALLBACK_TELEPHONE_NUMBER_W, CallBackTelePhoneNumber); 372 + 373 + if (!string.IsNullOrWhiteSpace(CarTelePhoneNumber)) 374 + TopLevelProperties.AddProperty(PropertyTags.PR_CAR_TELEPHONE_NUMBER_W, CarTelePhoneNumber); 375 + 376 + if (ChildrensNames != null) 377 + TopLevelProperties.AddProperty(PropertyTags.PR_CHILDRENS_NAMES_W, string.Join(", ", ChildrensNames)); 378 + 379 + if (CompanyMain != null) 380 + { 381 + if (!string.IsNullOrWhiteSpace(CompanyMain.Name)) 382 + TopLevelProperties.AddProperty(PropertyTags.PR_COMPANY_NAME_W, CompanyMain.Name); 383 + 384 + if (!string.IsNullOrWhiteSpace(CompanyMain.TelephoneNumber)) 385 + TopLevelProperties.AddProperty(PropertyTags.PR_COMPANY_MAIN_PHONE_NUMBER_W, CompanyMain.TelephoneNumber); 386 + } 387 + 388 + if (!string.IsNullOrWhiteSpace(DepartmentName)) 389 + TopLevelProperties.AddProperty(PropertyTags.PR_DEPARTMENT_NAME_W, DepartmentName); 390 + 391 + if (!string.IsNullOrWhiteSpace(Generation)) 392 + TopLevelProperties.AddProperty(PropertyTags.PR_GENERATION_W, Generation); 393 + 394 + if (!string.IsNullOrWhiteSpace(GivenName)) 395 + TopLevelProperties.AddProperty(PropertyTags.PR_GIVEN_NAME_W, GivenName); 396 + 397 + if (!string.IsNullOrWhiteSpace(Initials)) 398 + TopLevelProperties.AddProperty(PropertyTags.PR_INITIALS_W, Initials); 399 + 400 + if (!string.IsNullOrWhiteSpace(ISDNNumber)) 401 + TopLevelProperties.AddProperty(PropertyTags.PR_ISDN_NUMBER_W, ISDNNumber); 402 + 403 + if (!string.IsNullOrWhiteSpace(Language)) 404 + TopLevelProperties.AddProperty(PropertyTags.PR_LANGUAGE_W, Language); 405 + 406 + if (!string.IsNullOrWhiteSpace(Location)) 407 + TopLevelProperties.AddProperty(PropertyTags.PR_LOCATION_W, Location); 408 + 409 + if (!string.IsNullOrWhiteSpace(ManagerName)) 410 + TopLevelProperties.AddProperty(PropertyTags.PR_MANAGER_NAME_W, ManagerName); 411 + 412 + if (!string.IsNullOrWhiteSpace(MiddleName)) 413 + TopLevelProperties.AddProperty(PropertyTags.PR_MIDDLE_NAME_W, MiddleName); 414 + 415 + if (!string.IsNullOrWhiteSpace(MobileTelephoneNumber)) 416 + TopLevelProperties.AddProperty(PropertyTags.PR_MOBILE_TELEPHONE_NUMBER_W, MobileTelephoneNumber); 417 + 418 + if (!string.IsNullOrWhiteSpace(NickName)) 419 + TopLevelProperties.AddProperty(PropertyTags.PR_NICKNAME_W, NickName); 420 + 421 + if (!string.IsNullOrWhiteSpace(OfficeLocation)) 422 + TopLevelProperties.AddProperty(PropertyTags.PR_OFFICE_LOCATION_W, OfficeLocation); 423 + 424 + if (!string.IsNullOrWhiteSpace(OfficeTelephoneNumber)) 425 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS2_TELEPHONE_NUMBER_W, OfficeTelephoneNumber); 426 + 427 + if (!string.IsNullOrWhiteSpace(PersonalHomePage)) 428 + TopLevelProperties.AddProperty(PropertyTags.PR_PERSONAL_HOME_PAGE_W, PersonalHomePage); 429 + 430 + if (!string.IsNullOrWhiteSpace(PostalAddress)) 431 + TopLevelProperties.AddProperty(PropertyTags.PR_POSTAL_ADDRESS_W, PostalAddress); 432 + 433 + var addressBookProviderEmailList = new List<long>(); 434 + 435 + if (!string.IsNullOrWhiteSpace(PrimaryFaxNumber)) 436 + { 437 + TopLevelProperties.AddProperty(PropertyTags.PR_PRIMARY_FAX_NUMBER_W, PrimaryFaxNumber); 438 + addressBookProviderEmailList.Add(5); 439 + } 440 + 441 + if (!string.IsNullOrWhiteSpace(PrimaryTelephoneNumber)) 442 + TopLevelProperties.AddProperty(PropertyTags.PR_PRIMARY_TELEPHONE_NUMBER_W, PrimaryTelephoneNumber); 443 + 444 + if (!string.IsNullOrWhiteSpace(Profession)) 445 + TopLevelProperties.AddProperty(PropertyTags.PR_PROFESSION_W, Profession); 446 + 447 + if (!string.IsNullOrWhiteSpace(RadioTelephoneNumber)) 448 + TopLevelProperties.AddProperty(PropertyTags.PR_RADIO_TELEPHONE_NUMBER_W, RadioTelephoneNumber); 449 + 450 + if (!string.IsNullOrWhiteSpace(SpouseName)) 451 + TopLevelProperties.AddProperty(PropertyTags.PR_SPOUSE_NAME_W, SpouseName); 452 + 453 + if (!string.IsNullOrWhiteSpace(SurName)) 454 + TopLevelProperties.AddProperty(PropertyTags.PR_SURNAME_W, SurName); 455 + 456 + if (!string.IsNullOrWhiteSpace(TelexNumber)) 457 + TopLevelProperties.AddProperty(PropertyTags.PR_TELEX_NUMBER_W, TelexNumber); 458 + 459 + if (!string.IsNullOrWhiteSpace(Title)) 460 + TopLevelProperties.AddProperty(PropertyTags.PR_TITLE_W, Title); 461 + 462 + if (!string.IsNullOrWhiteSpace(TTYTDDPhoneNumber)) 463 + TopLevelProperties.AddProperty(PropertyTags.PR_TTYTDD_PHONE_NUMBER_W, TTYTDDPhoneNumber); 464 + 465 + if (!string.IsNullOrWhiteSpace(PagerTelephoneNumber)) 466 + TopLevelProperties.AddProperty(PropertyTags.PR_PAGER_TELEPHONE_NUMBER_W, PagerTelephoneNumber); 467 + 468 + var emailList = new List<long>(); 469 + 470 + if (Email1 != null) 471 + { 472 + emailList.Add(NamedPropertyTags.PidLidEmail1DisplayName.Id); 473 + addressBookProviderEmailList.Add(0); 474 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail1EmailAddress, Email1.Email); 475 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail1DisplayName, Email1.DisplayName); 476 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail1OriginalDisplayName, Email1.OriginalDisplayName); 477 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail1AddressType, Email1.AddressTypeString); 478 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail1OriginalEntryId, Email1.OneOffEntryId.ToByteArray()); 479 + } 480 + 481 + if (Email2 != null) 482 + { 483 + emailList.Add(NamedPropertyTags.PidLidEmail2DisplayName.Id); 484 + addressBookProviderEmailList.Add(1); 485 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail2EmailAddress, Email2.Email); 486 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail2DisplayName, Email2.DisplayName); 487 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail2OriginalDisplayName, Email2.OriginalDisplayName); 488 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail2AddressType, Email2.AddressTypeString); 489 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail2OriginalEntryId, Email2.OneOffEntryId.ToByteArray()); 490 + } 491 + 492 + if (Email3 != null) 493 + { 494 + emailList.Add(NamedPropertyTags.PidLidEmail3DisplayName.Id); 495 + addressBookProviderEmailList.Add(2); 496 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail3EmailAddress, Email3.Email); 497 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail3DisplayName, Email3.DisplayName); 498 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail3OriginalDisplayName, Email3.OriginalDisplayName); 499 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail3AddressType, Email3.AddressTypeString); 500 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmail3OriginalEntryId, Email3.OneOffEntryId.ToByteArray()); 501 + } 502 + 503 + if (emailList.Any()) 504 + NamedProperties.AddProperty(NamedPropertyTags.PidLidEmailList, emailList.ToArray()); 505 + 506 + //if (!string.IsNullOrWhiteSpace(Fax1)) 507 + //{ 508 + // var fax1 = new Address(Fax1, SubjectNormalized, AddressType.Fax); 509 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax1EmailAddress, fax1.Email); 510 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax1OriginalDisplayName, fax1.OriginalDisplayName); 511 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax1AddressType, fax1.AddressTypeString); 512 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax1OriginalEntryId, fax1.OneOffEntryId.ToByteArray()); 513 + //} 514 + 515 + //if (!string.IsNullOrWhiteSpace(Fax2)) 516 + //{ 517 + // var fax2 = new Address(Fax2, SubjectNormalized, AddressType.Fax); 518 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax2EmailAddress, fax2.Email); 519 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax2OriginalDisplayName, fax2.OriginalDisplayName); 520 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax2AddressType, fax2.AddressTypeString); 521 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax2OriginalEntryId, fax2.OneOffEntryId.ToByteArray()); 522 + //} 523 + 524 + //if (!string.IsNullOrWhiteSpace(Fax3)) 525 + //{ 526 + // var fax3 = new Address(Fax3, SubjectNormalized, AddressType.Fax); 527 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax3EmailAddress, fax3.Email); 528 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax3OriginalDisplayName, fax3.OriginalDisplayName); 529 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax3AddressType, fax3.AddressTypeString); 530 + // NamedProperties.AddProperty(NamedPropertyTags.PidLidFax3OriginalEntryId, fax3.OneOffEntryId.ToByteArray()); 531 + //} 532 + 533 + if (Yomi != null) 534 + { 535 + if (!string.IsNullOrWhiteSpace(Yomi.FirstName)) 536 + NamedProperties.AddProperty(NamedPropertyTags.PidLidYomiFirstName, Yomi.FirstName); 537 + 538 + if (!string.IsNullOrWhiteSpace(Yomi.LastName)) 539 + NamedProperties.AddProperty(NamedPropertyTags.PidLidYomiLastName, Yomi.LastName); 540 + 541 + if (!string.IsNullOrWhiteSpace(Yomi.CompanyName)) 542 + NamedProperties.AddProperty(NamedPropertyTags.PidLidYomiCompanyName, Yomi.CompanyName); 543 + } 544 + 545 + if (Work != null) 546 + { 547 + if (!string.IsNullOrWhiteSpace(Work.Address)) 548 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddress, Work.Address); 549 + 550 + if (!string.IsNullOrWhiteSpace(Work.Street)) 551 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressStreet, Work.Street); 552 + 553 + if (!string.IsNullOrWhiteSpace(Work.PostalCode)) 554 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressPostalCode, Work.PostalCode); 555 + 556 + if (!string.IsNullOrWhiteSpace(Work.PostOfficeBox)) 557 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressPostOfficeBox, Work.PostOfficeBox); 558 + 559 + if (!string.IsNullOrWhiteSpace(Work.City)) 560 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressCity, Work.City); 561 + 562 + if (!string.IsNullOrWhiteSpace(Work.Country)) 563 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressCountry, Work.Country); 564 + 565 + if (!string.IsNullOrWhiteSpace(Work.CountryCode)) 566 + NamedProperties.AddProperty(NamedPropertyTags.PidLidWorkAddressCountryCode, Work.CountryCode); 567 + } 568 + 569 + if (Business != null) 570 + { 571 + if (!string.IsNullOrWhiteSpace(Business.Street)) 572 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_ADDRESS_STREET_W, Business.Street); 573 + 574 + if (!string.IsNullOrWhiteSpace(Business.City)) 575 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_ADDRESS_CITY_W, Business.City); 576 + 577 + if (!string.IsNullOrWhiteSpace(Business.Country)) 578 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_ADDRESS_COUNTRY_W, Business.Country); 579 + 580 + if (!string.IsNullOrWhiteSpace(Business.PostalCode)) 581 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_ADDRESS_POSTAL_CODE_W, Business.PostalCode); 582 + 583 + if (!string.IsNullOrWhiteSpace(Business.State)) 584 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W, Business.State); 585 + 586 + if (!string.IsNullOrWhiteSpace(Business.HomePage)) 587 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_HOME_PAGE_W, Business.HomePage); 588 + 589 + if (!string.IsNullOrWhiteSpace(Business.TelephoneNumber)) 590 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_TELEPHONE_NUMBER_W, Business.TelephoneNumber); 591 + 592 + if (!string.IsNullOrWhiteSpace(Business.FaxNumber)) 593 + { 594 + TopLevelProperties.AddProperty(PropertyTags.PR_BUSINESS_FAX_NUMBER_W, Business.FaxNumber); 595 + addressBookProviderEmailList.Add(3); 596 + } 597 + } 598 + 599 + if (Home != null) 600 + { 601 + if (!string.IsNullOrWhiteSpace(Home.Address)) 602 + NamedProperties.AddProperty(NamedPropertyTags.PidLidHomeAddress, Home.Address); 603 + 604 + if (!string.IsNullOrWhiteSpace(Home.Street)) 605 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_ADDRESS_STREET_W, Home.Street); 606 + 607 + if (!string.IsNullOrWhiteSpace(Home.PostalCode)) 608 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_ADDRESS_POSTAL_CODE_W, Home.PostalCode); 609 + 610 + if (!string.IsNullOrWhiteSpace(Home.City)) 611 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_ADDRESS_CITY_W, Home.City); 612 + 613 + if (!string.IsNullOrWhiteSpace(Home.Country)) 614 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_ADDRESS_COUNTRY_W, Home.Country); 615 + 616 + if (!string.IsNullOrWhiteSpace(Home.TelephoneNumber)) 617 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_TELEPHONE_NUMBER_W, Home.TelephoneNumber); 618 + 619 + if (!string.IsNullOrWhiteSpace(Home.TelephoneNumber2)) 620 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME2_TELEPHONE_NUMBER_W, Home.TelephoneNumber2); 621 + 622 + if (!string.IsNullOrWhiteSpace(Home.FaxNumber)) 623 + { 624 + TopLevelProperties.AddProperty(PropertyTags.PR_HOME_FAX_NUMBER_W, Home.FaxNumber); 625 + addressBookProviderEmailList.Add(4); 626 + } 627 + } 628 + 629 + if (addressBookProviderEmailList.Any()) 630 + NamedProperties.AddProperty(NamedPropertyTags.PidLidAddressBookProviderEmailList, addressBookProviderEmailList.OrderBy(m => m).ToArray()); 631 + 632 + if (Other != null) 633 + { 634 + if (!string.IsNullOrWhiteSpace(Other.Address)) 635 + NamedProperties.AddProperty(NamedPropertyTags.PidLidOtherAddress, Other.Address); 636 + 637 + if (!string.IsNullOrWhiteSpace(Other.Street)) 638 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_ADDRESS_STREET_W, Other.Street); 639 + 640 + if (!string.IsNullOrWhiteSpace(Other.PostalCode)) 641 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_ADDRESS_POSTAL_CODE_W, Other.PostalCode); 642 + 643 + if (!string.IsNullOrWhiteSpace(Other.City)) 644 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_ADDRESS_CITY_W, Other.City); 645 + 646 + if (!string.IsNullOrWhiteSpace(Other.Country)) 647 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_ADDRESS_COUNTRY_W, Other.Country); 648 + 649 + if (!string.IsNullOrWhiteSpace(Other.State)) 650 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_ADDRESS_STATE_OR_PROVINCE_W, Other.State); 651 + 652 + if (!string.IsNullOrWhiteSpace(Other.TelephoneNumber)) 653 + TopLevelProperties.AddProperty(PropertyTags.PR_OTHER_TELEPHONE_NUMBER_W, Other.TelephoneNumber); 654 + } 655 + } 656 + #endregion 657 + 658 + #region Save 659 + /// <summary> 660 + /// Saves the message to the given <paramref name="stream" /> 661 + /// </summary> 662 + /// <param name="stream"></param> 663 + public new void Save(Stream stream) 664 + { 665 + WriteToStorage(); 666 + base.Save(stream); 667 + } 668 + 669 + /// <summary> 670 + /// Saves the message to the given <paramref name="fileName" /> 671 + /// </summary> 672 + /// <param name="fileName"></param> 673 + public new void Save(string fileName) 674 + { 675 + WriteToStorage(); 676 + base.Save(fileName); 677 + } 678 + #endregion 679 + } 680 + } 681 + -
1 + // 2 + // ContactAssistant.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> assistent 32 + /// </summary> 33 + public class ContactAssistant 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The name of the assistant 38 + /// </summary> 39 + public string Name { get; set; } 40 + 41 + /// <summary> 42 + /// The telephone number of the assistant 43 + /// </summary> 44 + public string TelephoneNumber{ get; set; } 45 + #endregion 46 + } 47 + } 48 + -
1 + // 2 + // ContactBusiness.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> business 32 + /// </summary> 33 + public class ContactBusiness : ContactOther 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The home-page 38 + /// </summary> 39 + public string HomePage { get; set; } 40 + 41 + /// <summary> 42 + /// The fax number 43 + /// </summary> 44 + public string FaxNumber { get; set; } 45 + #endregion 46 + } 47 + } -
1 + // 2 + // ContactCommon.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// A placeholder for the <see cref="ContactWork"/>, <see cref="ContactOther"/> and <see cref="ContactBusiness"/> common properties 32 + /// </summary> 33 + public class ContactCommon 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The street for the address 38 + /// </summary> 39 + public string Street { get; set; } 40 + 41 + /// <summary> 42 + /// The country for the address 43 + /// </summary> 44 + public string Country { get; set; } 45 + 46 + /// <summary> 47 + /// The postal code for the address 48 + /// </summary> 49 + public string PostalCode { get; set; } 50 + 51 + /// <summary> 52 + /// The city for the address 53 + /// </summary> 54 + public string City { get; set; } 55 + 56 + /// <summary> 57 + /// The telephone number 58 + /// </summary> 59 + public string TelephoneNumber { get; set; } 60 + #endregion 61 + } 62 + } 63 + -
1 + // 2 + // ContactAssistant.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> company main info 32 + /// </summary> 33 + public class ContactCompanyMain : ContactAssistant 34 + { 35 + } 36 + } 37 + -
1 + // 2 + // ContactHome.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> work address 32 + /// </summary> 33 + public class ContactHome : ContactOther 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The way the home address is displayed in the contact card<br/> 38 + /// Some Street<br/> 39 + /// Zip code Place<br/> 40 + /// Some land<br/> 41 + /// </summary> 42 + public string Address { get; set; } 43 + 44 + /// <summary> 45 + /// The fax number 46 + /// </summary> 47 + public string FaxNumber { get; set; } 48 + 49 + /// <summary> 50 + /// The telephone 2 number 51 + /// </summary> 52 + public string TelephoneNumber2 { get; set; } 53 + #endregion 54 + } 55 + } 56 + -
1 + // 2 + // ContactOther.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> other address 32 + /// </summary> 33 + public class ContactOther : ContactCommon 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The way the home address is displayed in the contact card<br/> 38 + /// Some Street<br/> 39 + /// Zip code Place<br/> 40 + /// Some land<br/> 41 + /// </summary> 42 + public string Address { get; set; } 43 + 44 + /// <summary> 45 + /// The state for the address 46 + /// </summary> 47 + public string State { get; set; } 48 + #endregion 49 + } 50 + } 51 + -
1 + // 2 + // ContactWork.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> work address 32 + /// </summary> 33 + public class ContactWork : ContactCommon 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The way the work address is displayed in the contact card<br/> 38 + /// Some Street<br/> 39 + /// Zip code Place<br/> 40 + /// Some land<br/> 41 + /// </summary> 42 + public string Address { get; set; } 43 + 44 + /// <summary> 45 + /// The post office box for the address 46 + /// </summary> 47 + public string PostOfficeBox { get; set; } 48 + 49 + /// <summary> 50 + /// The country code for the address 51 + /// </summary> 52 + public string CountryCode { get; set; } 53 + #endregion 54 + } 55 + } 56 + -
1 + // 2 + // ContactYomi.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable UnusedAutoPropertyAccessor.Global 28 + namespace MsgKit 29 + { 30 + /// <summary> 31 + /// Placeholder for a <see cref="Contact"/> other address 32 + /// </summary> 33 + public class ContactYomi 34 + { 35 + #region Properties 36 + /// <summary> 37 + /// The first name 38 + /// </summary> 39 + public string FirstName { get; set; } 40 + 41 + /// <summary> 42 + /// The last name 43 + /// </summary> 44 + public string LastName{ get; set; } 45 + 46 + /// <summary> 47 + /// The company name 48 + /// </summary> 49 + public string CompanyName { get; set; } 50 + #endregion 51 + } 52 + } 53 + -
1 + // 2 + // Converter.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using System.IO; 29 + using System.Text; 30 + using MimeKit; 31 + using MsgKit.Exceptions; 32 + using MsgKit.Helpers; 33 + 34 + namespace MsgKit 35 + { 36 + /// <summary> 37 + /// This class exposes some methods to convert MSG to EML and vice versa 38 + /// </summary> 39 + public static class Converter 40 + { 41 + #region ConvertEmlToMsg 42 + /// <summary> 43 + /// Converts an EML file to MSG format 44 + /// </summary> 45 + /// <param name="emlFileName">The EML (MIME) file</param> 46 + /// <param name="msgFileName">The MSG file</param> 47 + public static void ConvertEmlToMsg(string emlFileName, string msgFileName) 48 + { 49 + using (var emlFile = new FileStream(emlFileName, FileMode.Open)) 50 + using (var msgFile = new FileStream(msgFileName, FileMode.CreateNew)) 51 + { 52 + ConvertEmlToMsg(emlFile, msgFile); 53 + } 54 + } 55 + 56 + /// <summary> 57 + /// Converts an EML file to MSG format 58 + /// </summary> 59 + /// <param name="emlFile">The EML (MIME) input stream</param> 60 + /// <param name="msgFile">The MSG file output stream</param> 61 + public static void ConvertEmlToMsg(Stream emlFile, Stream msgFile) 62 + { 63 + var eml = MimeMessage.Load(emlFile); 64 + var sender = new Sender(string.Empty, string.Empty); 65 + 66 + if (eml.From.Count > 0) 67 + { 68 + var mailAddress = (MailboxAddress)eml.From[0]; 69 + sender = new Sender(mailAddress.Address, mailAddress.Name); 70 + } 71 + 72 + var representing = new Representing(string.Empty, string.Empty); 73 + if (eml.ResentSender != null) 74 + representing = new Representing(eml.ResentSender.Address, eml.ResentSender.Name); 75 + 76 + var msg = new Email(sender, representing, eml.Subject) 77 + { 78 + SentOn = eml.Date.UtcDateTime, 79 + InternetMessageId = eml.MessageId 80 + }; 81 + 82 + using (var memoryStream = new MemoryStream()) 83 + { 84 + eml.Headers.WriteTo(memoryStream); 85 + msg.TransportMessageHeadersText = Encoding.ASCII.GetString(memoryStream.ToArray()); 86 + } 87 + 88 + switch (eml.Priority) 89 + { 90 + case MessagePriority.NonUrgent: 91 + msg.Priority = Enums.MessagePriority.PRIO_NONURGENT; 92 + break; 93 + case MessagePriority.Normal: 94 + msg.Priority = Enums.MessagePriority.PRIO_NORMAL; 95 + break; 96 + case MessagePriority.Urgent: 97 + msg.Priority = Enums.MessagePriority.PRIO_URGENT; 98 + break; 99 + } 100 + 101 + switch (eml.Importance) 102 + { 103 + case MessageImportance.Low: 104 + msg.Importance = Enums.MessageImportance.IMPORTANCE_LOW; 105 + break; 106 + case MessageImportance.Normal: 107 + msg.Importance = Enums.MessageImportance.IMPORTANCE_NORMAL; 108 + break; 109 + case MessageImportance.High: 110 + msg.Importance = Enums.MessageImportance.IMPORTANCE_HIGH; 111 + break; 112 + } 113 + 114 + foreach (var to in eml.To) 115 + { 116 + var mailAddress = (MailboxAddress)to; 117 + msg.Recipients.AddTo(mailAddress.Address, mailAddress.Name); 118 + } 119 + 120 + foreach (var cc in eml.Cc) 121 + { 122 + var mailAddress = (MailboxAddress)cc; 123 + msg.Recipients.AddCc(mailAddress.Address, mailAddress.Name); 124 + } 125 + 126 + foreach (var bcc in eml.Bcc) 127 + { 128 + var mailAddress = (MailboxAddress)bcc; 129 + msg.Recipients.AddBcc(mailAddress.Address, mailAddress.Name); 130 + } 131 + 132 + using (var headerStream = new MemoryStream()) 133 + { 134 + eml.Headers.WriteTo(headerStream); 135 + headerStream.Position = 0; 136 + msg.TransportMessageHeadersText = Encoding.ASCII.GetString(headerStream.ToArray()); 137 + } 138 + 139 + var namelessCount = 0; 140 + var index = 1; 141 + 142 + // This loops through the top-level parts (i.e. it doesn't open up attachments and continue to traverse). 143 + // As such, any included messages are just attachments here. 144 + foreach (var bodyPart in eml.BodyParts) 145 + { 146 + var handled = false; 147 + 148 + // The first text/plain part (that's not an attachment) is the body part. 149 + if(!bodyPart.IsAttachment && bodyPart is TextPart text) 150 + { 151 + // Sets the first matching inline content type for body parts. 152 + 153 + if(msg.BodyText == null && text.IsPlain) 154 + { 155 + msg.BodyText = text.Text; 156 + handled = true; 157 + } 158 + 159 + if(msg.BodyHtml == null && text.IsHtml) 160 + { 161 + msg.BodyHtml = text.Text; 162 + handled = true; 163 + } 164 + 165 + if(msg.BodyRtf == null && text.IsRichText) 166 + { 167 + msg.BodyRtf = text.Text; 168 + handled = true; 169 + } 170 + } 171 + 172 + // If the part hasn't previously been handled by "body" part handling 173 + if (!handled) 174 + { 175 + var attachmentStream = new MemoryStream(); 176 + var fileName = bodyPart.ContentType.Name; 177 + var extension = string.Empty; 178 + 179 + if (bodyPart is MessagePart messagePart) 180 + { 181 + messagePart.Message.WriteTo(attachmentStream); 182 + if (messagePart.Message != null) 183 + fileName = messagePart.Message.Subject; 184 + 185 + extension = ".eml"; 186 + } 187 + else if (bodyPart is MessageDispositionNotification) 188 + { 189 + var part = (MessageDispositionNotification)bodyPart; 190 + fileName = part.FileName; 191 + } 192 + else if (bodyPart is MessageDeliveryStatus) 193 + { 194 + var part = (MessageDeliveryStatus)bodyPart; 195 + fileName = "details"; 196 + extension = ".txt"; 197 + part.WriteTo(FormatOptions.Default, attachmentStream, true); 198 + } 199 + else 200 + { 201 + var part = (MimePart)bodyPart; 202 + part.Content.DecodeTo(attachmentStream); 203 + fileName = part.FileName; 204 + } 205 + 206 + fileName = string.IsNullOrWhiteSpace(fileName) 207 + ? $"part_{++namelessCount:00}" 208 + : FileManager.RemoveInvalidFileNameChars(fileName); 209 + 210 + if (!string.IsNullOrEmpty(extension)) 211 + fileName += extension; 212 + 213 + var inline = bodyPart.ContentDisposition != null && 214 + bodyPart.ContentId != null && 215 + bodyPart.ContentDisposition.Disposition.Equals("inline", 216 + StringComparison.InvariantCultureIgnoreCase); 217 + 218 + attachmentStream.Position = 0; 219 + 220 + try 221 + { 222 + msg.Attachments.Add(attachmentStream, fileName, -1, inline, bodyPart.ContentId); 223 + } 224 + catch (MKAttachmentExists) 225 + { 226 + var tempFileName = Path.GetFileNameWithoutExtension(fileName); 227 + var tempExtension = Path.GetExtension(fileName); 228 + msg.Attachments.Add(attachmentStream, $"{tempFileName}({index}){tempExtension}", -1, inline, bodyPart.ContentId); 229 + index += 1; 230 + } 231 + } 232 + } 233 + 234 + msg.Save(msgFile); 235 + } 236 + #endregion 237 + 238 + #region ConvertMsgToEml 239 + /// <summary> 240 + /// Converts an MSG file to EML format 241 + /// </summary> 242 + /// <param name="msgFileName">The MSG file</param> 243 + /// <param name="emlFileName">The EML (MIME) file</param> 244 + public static void ConvertMsgToEml(string msgFileName, string emlFileName) 245 + { 246 + //var eml = MimeKit.MimeMessage.CreateFromMailMessage() 247 + throw new NotImplementedException("Not yet done"); 248 + } 249 + #endregion 250 + } 251 + } 252 + -
1 + // 2 + // Email.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + using System.Collections.Generic; 29 + using System.Globalization; 30 + using System.Linq; 31 + using System.Text; 32 + using System.Text.RegularExpressions; 33 + using MsgKit.Enums; 34 + using MsgKit.Helpers; 35 + using MsgKit.Mime.Header; 36 + using MsgKit.Structures; 37 + using OpenMcdf; 38 + using MessageImportance = MsgKit.Enums.MessageImportance; 39 + using MessagePriority = MsgKit.Enums.MessagePriority; 40 + using Stream = System.IO.Stream; 41 + // ReSharper disable MemberCanBePrivate.Global 42 + // ReSharper disable UnusedAutoPropertyAccessor.Global 43 + 44 + namespace MsgKit 45 + { 46 + /// <summary> 47 + /// A class used to make a new Outlook E-mail MSG file 48 + /// </summary> 49 + /// <remarks> 50 + /// See https://msdn.microsoft.com/en-us/library/office/cc979231.aspx 51 + /// </remarks> 52 + public class Email : Message, IDisposable 53 + { 54 + #region Fields 55 + /// <summary> 56 + /// The <see cref="Regex" /> to find the prefix in a subject 57 + /// </summary> 58 + private static readonly Regex SubjectPrefixRegex = new Regex(@"^(\D{1,3}:\s)(.*)$"); 59 + 60 + /// <summary> 61 + /// The E-mail <see cref="Recipients" /> 62 + /// </summary> 63 + private Recipients _recipients; 64 + 65 + /// <summary> 66 + /// The E-mail <see cref="Recipients" /> 67 + /// </summary> 68 + private Recipients _replyToRecipients; 69 + 70 + /// <summary> 71 + /// The E-mail <see cref="Attachments" /> 72 + /// </summary> 73 + private Attachments _attachments; 74 + 75 + /// <summary> 76 + /// The subject of the E-mail 77 + /// </summary> 78 + private string _subject; 79 + #endregion 80 + 81 + #region Properties 82 + /// <summary> 83 + /// Returns the sender of the E-mail from the <see cref="Recipients" /> 84 + /// </summary> 85 + public Sender Sender { get; } 86 + 87 + /// <summary> 88 + /// Contains the e-mail address for the messaging user represented by the <see cref="Sender"/>. 89 + /// </summary> 90 + /// <remarks> 91 + /// These properties are examples of the address properties for the messaging user who is being represented by the 92 + /// <see cref="Receiving" /> user. They must be set by the incoming transport provider, which is also responsible for 93 + /// authorization or verification of the delegate. If no messaging user is being represented, these properties should 94 + /// be set to the e-mail address contained in the PR_RECEIVED_BY_EMAIL_ADDRESS (PidTagReceivedByEmailAddress) property. 95 + /// </remarks> 96 + public Representing Representing { get; } 97 + 98 + /// <summary> 99 + /// Returns the E-mail <see cref="Recipients" /> 100 + /// </summary> 101 + public Recipients Recipients => _recipients ?? (_recipients = new Recipients()); 102 + 103 + /// <summary> 104 + /// Returns the E-mail <see cref="Recipients" /> 105 + /// </summary> 106 + public Recipients ReplyToRecipients => _replyToRecipients ?? (_replyToRecipients = new Recipients()); 107 + 108 + /// <summary> 109 + /// Contains the e-mail address for the messaging user who receives the message. 110 + /// </summary> 111 + /// <remarks> 112 + /// These properties are examples of the address properties for the messaging user who receives the message. They must 113 + /// be set by the incoming transport provider. 114 + /// </remarks> 115 + public Receiving Receiving { get; set; } 116 + 117 + /// <summary> 118 + /// Contains the e-mail address for the messaging user who is represented by the <see cref="Receiving"/> user. 119 + /// </summary> 120 + /// <remarks> 121 + /// These properties are examples of the address properties for the messaging user who is being represented by the 122 + /// <see cref="Receiving" /> user. They must be set by the incoming transport provider, which is also responsible for 123 + /// authorization or verification of the delegate. If no messaging user is being represented, these properties should 124 + /// be set to the e-mail address contained in the PR_RECEIVED_BY_EMAIL_ADDRESS (PidTagReceivedByEmailAddress) property. 125 + /// </remarks> 126 + public ReceivingRepresenting ReceivingRepresenting { get; internal set; } 127 + 128 + /// <summary> 129 + /// Returns the subject prefix of the E-mail 130 + /// </summary> 131 + public string SubjectPrefix { get; private set; } 132 + 133 + /// <summary> 134 + /// Returns or sets the subject of the E-mail 135 + /// </summary> 136 + public string Subject 137 + { 138 + get => _subject; 139 + set 140 + { 141 + _subject = value; 142 + SetSubject(); 143 + } 144 + } 145 + 146 + /// <summary> 147 + /// Returns the normalized subject of the E-mail 148 + /// </summary> 149 + public string SubjectNormalized { get; private set; } 150 + 151 + /// <summary> 152 + /// Returns or sets the <see cref="Enums.MessagePriority"/> 153 + /// </summary> 154 + public MessagePriority Priority { get; set; } 155 + 156 + /// <summary> 157 + /// Returns or sets the <see cref="Enums.MessageImportance"/> 158 + /// </summary> 159 + public MessageImportance Importance { get; set; } 160 + 161 + /// <summary> 162 + /// Returns or sets the text body of the E-mail 163 + /// </summary> 164 + public string BodyText { get; set; } 165 + 166 + /// <summary> 167 + /// Returns or sets the html body of the E-mail 168 + /// </summary> 169 + public string BodyHtml { get; set; } 170 + 171 + /// <summary> 172 + /// The compressed RTF body part 173 + /// </summary> 174 + /// <remarks> 175 + /// When not set then the RTF is generated from <see cref="BodyHtml"/> (when this property is set) 176 + /// </remarks> 177 + public string BodyRtf { get; set; } 178 + 179 + /// <summary> 180 + /// Returns or set to <c>true</c> when <see cref="BodyRtf"/> is compressed 181 + /// </summary> 182 + public bool BodyRtfCompressed { get; set; } 183 + 184 + /// <summary> 185 + /// The E-mail <see cref="Attachments" /> 186 + /// </summary> 187 + public Attachments Attachments => _attachments ?? (_attachments = new Attachments()); 188 + 189 + /// <summary> 190 + /// Returns or sets the UTC date and time the <see cref="Sender"/> has submitted the 191 + /// <see cref="Message"/> 192 + /// </summary> 193 + /// <remarks> 194 + /// This property has to be set to UTC datetime. When not set then the current date 195 + /// and time is used 196 + /// </remarks> 197 + public DateTime? SentOn { get; set; } 198 + 199 + /// <summary> 200 + /// Returns the UTC date and time when the <see cref="Message"/> was received 201 + /// </summary> 202 + /// <remarks> 203 + /// This property has to be set to UTC datetime 204 + /// </remarks> 205 + public DateTime? ReceivedOn { get; set; } 206 + 207 + /// <summary> 208 + /// Returns or sets the Internet Message Id 209 + /// </summary> 210 + /// <remarks> 211 + /// Corresponds to the message ID field as specified in [RFC2822].<br/><br/> 212 + /// If set then this value will be used, when not set the value will be read from the 213 + /// <see cref="TransportMessageHeaders"/> when this property is set 214 + /// </remarks> 215 + public string InternetMessageId { get; set; } 216 + 217 + /// <summary> 218 + /// Returns or set the the value of a Multipurpose Internet Mail Extensions (MIME) message's References header field 219 + /// </summary> 220 + /// <remarks> 221 + /// If set then this value will be used, when not set the value will be read from the 222 + /// <see cref="TransportMessageHeaders"/> when this property is set 223 + /// </remarks> 224 + public string InternetReferences { get; set; } 225 + 226 + /// <summary> 227 + /// Returns or sets the original message's PR_INTERNET_MESSAGE_ID (PidTagInternetMessageId) property value 228 + /// </summary> 229 + /// <remarks> 230 + /// If set then this value will be used, when not set the value will be read from the 231 + /// <see cref="TransportMessageHeaders"/> when this property is set 232 + /// </remarks> 233 + public string InReplyToId { get; set; } 234 + 235 + /// <summary> 236 + /// Sets or returns the <see cref="TransportMessageHeaders"/> property as a string (text). 237 + /// This property expects the headers as a string 238 + /// </summary> 239 + public string TransportMessageHeadersText 240 + { 241 + set => TransportMessageHeaders = HeaderExtractor.GetHeaders(value); 242 + get => TransportMessageHeaders != null ? TransportMessageHeaders.ToString() : string.Empty; 243 + } 244 + 245 + /// <summary> 246 + /// Returns or sets the transport message headers. These are only present when 247 + /// the message has been sent outside an Exchange environment to another mailserver 248 + /// <c>null</c> will be returned when not present 249 + /// </summary> 250 + /// <remarks> 251 + /// Use the <see cref="TransportMessageHeaders"/> property if you want to set 252 + /// the headers directly from a string otherwise see the example code below. 253 + /// </remarks> 254 + /// <example> 255 + /// <code> 256 + /// var email = new Email(); 257 + /// email.TransportMessageHeaders = new MessageHeader(); 258 + /// // ... do something with it, for example 259 + /// email.TransportMessageHeaders.SetHeaderValue("X-MY-CUSTOM-HEADER", "EXAMPLE VALUE"); 260 + /// </code> 261 + /// </example> 262 + public MessageHeader TransportMessageHeaders { get; set; } 263 + 264 + /// <summary> 265 + /// Returns <c>true</c> when the message is set as a draft message 266 + /// </summary> 267 + public bool Draft { get; } 268 + 269 + /// <summary> 270 + /// Returns <c>true</c> when a read receipt is requested 271 + /// </summary> 272 + public bool ReadRecipient { get; } 273 + 274 + /// <summary> 275 + /// Specifies the format for an editor to use to display a message. 276 + /// </summary> 277 + public MessageEditorFormat MessageEditorFormat { get; set; } 278 + #endregion 279 + 280 + #region Constructor 281 + /// <summary> 282 + /// Creates this object and sets all the needed properties 283 + /// </summary> 284 + /// <param name="sender">The <see cref="Sender"/> of the E-mail</param> 285 + /// <param name="subject">The subject of the E-mail</param> 286 + /// <param name="draft">Set to <c>true</c> to save the E-mail as a draft message</param> 287 + /// <param name="readReceipt">Set to <c>true</c> to request a read receipt for the E-mail</param> 288 + public Email(Sender sender, 289 + string subject, 290 + bool draft = false, 291 + bool readReceipt = false) 292 + { 293 + Sender = sender; 294 + Subject = subject; 295 + Importance = MessageImportance.IMPORTANCE_NORMAL; 296 + IconIndex = MessageIconIndex.NewMail; 297 + Draft = draft; 298 + ReadRecipient = readReceipt; 299 + } 300 + 301 + /// <summary> 302 + /// Creates this object and sets all the needed properties 303 + /// </summary> 304 + /// <param name="sender">The <see cref="Sender"/> of the E-mail</param> 305 + /// <param name="representing">The <see cref="MsgKit.Representing"/> sender of the E-mail</param> 306 + /// <param name="subject">The subject of the E-mail</param> 307 + /// <param name="draft">Set to <c>true</c> to save the E-mail as a draft message</param> 308 + /// <param name="readReceipt">Set to <c>true</c> to request a read receipt for the E-mail</param> 309 + public Email(Sender sender, 310 + Representing representing, 311 + string subject, 312 + bool draft = false, 313 + bool readReceipt = false) 314 + { 315 + Sender = sender; 316 + Representing = representing; 317 + Subject = subject; 318 + Importance = MessageImportance.IMPORTANCE_NORMAL; 319 + IconIndex = MessageIconIndex.NewMail; 320 + Draft = draft; 321 + ReadRecipient = readReceipt; 322 + } 323 + #endregion 324 + 325 + #region SetSubject 326 + /// <summary> 327 + /// These properties are computed by message store or transport providers from the PR_SUBJECT (PidTagSubject) 328 + /// and PR_SUBJECT_PREFIX (PidTagSubjectPrefix) properties in the following manner. If the PR_SUBJECT_PREFIX 329 + /// is present and is an initial substring of PR_SUBJECT, PR_NORMALIZED_SUBJECT and associated properties are 330 + /// set to the contents of PR_SUBJECT with the prefix removed. If PR_SUBJECT_PREFIX is present, but it is not 331 + /// an initial substring of PR_SUBJECT, PR_SUBJECT_PREFIX is deleted and recalculated from PR_SUBJECT using 332 + /// the following rule: If the string contained in PR_SUBJECT begins with one to three non-numeric characters 333 + /// followed by a colon and a space, then the string together with the colon and the blank becomes the prefix. 334 + /// Numbers, blanks, and punctuation characters are not valid prefix characters. If PR_SUBJECT_PREFIX is not 335 + /// present, it is calculated from PR_SUBJECT using the rule outlined in the previous step.This property then 336 + /// is set to the contents of PR_SUBJECT with the prefix removed. 337 + /// </summary> 338 + /// <remarks> 339 + /// When PR_SUBJECT_PREFIX is an empty string, PR_SUBJECT and PR_NORMALIZED_SUBJECT are the same. Ultimately, 340 + /// this property should be the part of PR_SUBJECT following the prefix. If there is no prefix, this property 341 + /// becomes the same as PR_SUBJECT. 342 + /// </remarks> 343 + protected void SetSubject() 344 + { 345 + if (!string.IsNullOrEmpty(SubjectPrefix) && !string.IsNullOrEmpty(Subject)) 346 + { 347 + if (Subject.StartsWith(SubjectPrefix)) 348 + { 349 + SubjectNormalized = Subject.Substring(SubjectPrefix.Length); 350 + } 351 + else 352 + { 353 + var matches = SubjectPrefixRegex.Matches(Subject); 354 + if (matches.Count > 0) 355 + { 356 + SubjectPrefix = matches.OfType<Match>().First().Groups[1].Value; 357 + SubjectNormalized = matches.OfType<Match>().First().Groups[2].Value; 358 + } 359 + } 360 + } 361 + else if (!string.IsNullOrEmpty(Subject)) 362 + { 363 + var matches = SubjectPrefixRegex.Matches(Subject); 364 + if (matches.Count > 0) 365 + { 366 + SubjectPrefix = matches.OfType<Match>().First().Groups[1].Value; 367 + SubjectNormalized = matches.OfType<Match>().First().Groups[2].Value; 368 + } 369 + else 370 + SubjectNormalized = Subject; 371 + } 372 + else 373 + SubjectNormalized = Subject; 374 + 375 + if (SubjectPrefix == null) SubjectPrefix = string.Empty; 376 + } 377 + #endregion 378 + 379 + #region WriteToStorage 380 + /// <summary> 381 + /// Writes all the properties that are part of the <see cref="Email"/> object either as <see cref="CFStorage"/>'s 382 + /// or <see cref="CFStream"/>'s to the <see cref="CompoundFile.RootStorage"/> 383 + /// </summary> 384 + internal void WriteToStorage() 385 + { 386 + var rootStorage = CompoundFile.RootStorage; 387 + 388 + if (Class == MessageClass.Unknown) 389 + Class = MessageClass.IPM_Note; 390 + 391 + MessageSize += Recipients.WriteToStorage(rootStorage); 392 + MessageSize += Attachments.WriteToStorage(rootStorage); 393 + 394 + var recipientCount = Recipients.Count; 395 + var attachmentCount = Attachments.Count; 396 + TopLevelProperties.RecipientCount = recipientCount; 397 + TopLevelProperties.AttachmentCount = attachmentCount; 398 + TopLevelProperties.NextRecipientId = recipientCount; 399 + TopLevelProperties.NextAttachmentId = attachmentCount; 400 + 401 + TopLevelProperties.AddProperty(PropertyTags.PR_ENTRYID, Mapi.GenerateEntryId()); 402 + TopLevelProperties.AddProperty(PropertyTags.PR_INSTANCE_KEY, Mapi.GenerateInstanceKey()); 403 + TopLevelProperties.AddProperty(PropertyTags.PR_STORE_SUPPORT_MASK, StoreSupportMaskConst.StoreSupportMask, PropertyFlags.PROPATTR_READABLE); 404 + TopLevelProperties.AddProperty(PropertyTags.PR_STORE_UNICODE_MASK, StoreSupportMaskConst.StoreSupportMask, PropertyFlags.PROPATTR_READABLE); 405 + TopLevelProperties.AddProperty(PropertyTags.PR_ALTERNATE_RECIPIENT_ALLOWED, true, PropertyFlags.PROPATTR_READABLE); 406 + TopLevelProperties.AddProperty(PropertyTags.PR_HASATTACH, attachmentCount > 0); 407 + 408 + if (TransportMessageHeaders != null) 409 + { 410 + TopLevelProperties.AddProperty(PropertyTags.PR_TRANSPORT_MESSAGE_HEADERS_W, TransportMessageHeaders.ToString()); 411 + 412 + if (!string.IsNullOrWhiteSpace(TransportMessageHeaders.MessageId)) 413 + TopLevelProperties.AddProperty(PropertyTags.PR_INTERNET_MESSAGE_ID_W, TransportMessageHeaders.MessageId); 414 + 415 + if (TransportMessageHeaders.References.Any()) 416 + TopLevelProperties.AddProperty(PropertyTags.PR_INTERNET_REFERENCES_W, TransportMessageHeaders.References.Last()); 417 + 418 + if (TransportMessageHeaders.InReplyTo.Any()) 419 + TopLevelProperties.AddProperty(PropertyTags.PR_IN_REPLY_TO_ID_W, TransportMessageHeaders.InReplyTo.Last()); 420 + } 421 + 422 + if (!string.IsNullOrWhiteSpace(InternetMessageId)) 423 + TopLevelProperties.AddOrReplaceProperty(PropertyTags.PR_INTERNET_MESSAGE_ID_W, InternetMessageId); 424 + 425 + if (!string.IsNullOrWhiteSpace(InternetReferences)) 426 + TopLevelProperties.AddOrReplaceProperty(PropertyTags.PR_INTERNET_REFERENCES_W, InternetReferences); 427 + 428 + if (!string.IsNullOrWhiteSpace(InReplyToId)) 429 + TopLevelProperties.AddOrReplaceProperty(PropertyTags.PR_IN_REPLY_TO_ID_W, InReplyToId); 430 + 431 + var messageFlags = MessageFlags.MSGFLAG_UNMODIFIED; 432 + 433 + if (attachmentCount > 0) 434 + messageFlags |= MessageFlags.MSGFLAG_HASATTACH; 435 + 436 + TopLevelProperties.AddProperty(PropertyTags.PR_INTERNET_CPID, Encoding.UTF8.CodePage); 437 + 438 + TopLevelProperties.AddProperty(PropertyTags.PR_BODY_W, BodyText); 439 + 440 + if (!string.IsNullOrEmpty(BodyHtml) && !Draft) 441 + { 442 + TopLevelProperties.AddProperty(PropertyTags.PR_HTML, BodyHtml); 443 + TopLevelProperties.AddProperty(PropertyTags.PR_RTF_IN_SYNC, false); 444 + } 445 + else if (string.IsNullOrWhiteSpace(BodyRtf) && !string.IsNullOrWhiteSpace(BodyHtml)) 446 + { 447 + BodyRtf = Strings.GetEscapedRtf(BodyHtml); 448 + BodyRtfCompressed = true; 449 + } 450 + 451 + if (!string.IsNullOrWhiteSpace(BodyRtf)) 452 + { 453 + TopLevelProperties.AddProperty(PropertyTags.PR_RTF_COMPRESSED, new RtfCompressor().Compress(Encoding.ASCII.GetBytes(BodyRtf))); 454 + TopLevelProperties.AddProperty(PropertyTags.PR_RTF_IN_SYNC, BodyRtfCompressed); 455 + } 456 + 457 + if (MessageEditorFormat != MessageEditorFormat.EDITOR_FORMAT_DONTKNOW) 458 + TopLevelProperties.AddProperty(PropertyTags.PR_MSG_EDITOR_FORMAT, MessageEditorFormat); 459 + 460 + if (!SentOn.HasValue) 461 + SentOn = DateTime.UtcNow; 462 + 463 + if (ReceivedOn.HasValue) 464 + TopLevelProperties.AddProperty(PropertyTags.PR_MESSAGE_DELIVERY_TIME, ReceivedOn.Value.ToUniversalTime()); 465 + 466 + TopLevelProperties.AddProperty(PropertyTags.PR_CLIENT_SUBMIT_TIME, SentOn.Value.ToUniversalTime()); 467 + TopLevelProperties.AddProperty(PropertyTags.PR_ACCESS, MapiAccess.MAPI_ACCESS_DELETE | MapiAccess.MAPI_ACCESS_MODIFY | MapiAccess.MAPI_ACCESS_READ); 468 + TopLevelProperties.AddProperty(PropertyTags.PR_ACCESS_LEVEL, MapiAccess.MAPI_ACCESS_MODIFY); 469 + TopLevelProperties.AddProperty(PropertyTags.PR_OBJECT_TYPE, MapiObjectType.MAPI_MESSAGE); 470 + 471 + SetSubject(); 472 + TopLevelProperties.AddProperty(PropertyTags.PR_SUBJECT_W, Subject); 473 + TopLevelProperties.AddProperty(PropertyTags.PR_NORMALIZED_SUBJECT_W, SubjectNormalized); 474 + TopLevelProperties.AddProperty(PropertyTags.PR_SUBJECT_PREFIX_W, SubjectPrefix); 475 + TopLevelProperties.AddProperty(PropertyTags.PR_CONVERSATION_TOPIC_W, SubjectNormalized); 476 + 477 + // http://www.meridiandiscovery.com/how-to/e-mail-conversation-index-metadata-computer-forensics/ 478 + // http://stackoverflow.com/questions/11860540/does-outlook-embed-a-messageid-or-equivalent-in-its-email-elements 479 + //propertiesStream.AddProperty(PropertyTags.PR_CONVERSATION_INDEX, Subject); 480 + 481 + // TODO: Change modification time when this message is opened and only modified 482 + var utcNow = DateTime.UtcNow; 483 + TopLevelProperties.AddProperty(PropertyTags.PR_CREATION_TIME, utcNow); 484 + TopLevelProperties.AddProperty(PropertyTags.PR_LAST_MODIFICATION_TIME, utcNow); 485 + TopLevelProperties.AddProperty(PropertyTags.PR_PRIORITY, Priority); 486 + TopLevelProperties.AddProperty(PropertyTags.PR_IMPORTANCE, Importance); 487 + TopLevelProperties.AddProperty(PropertyTags.PR_MESSAGE_LOCALE_ID, CultureInfo.CurrentCulture.LCID); 488 + 489 + if (Draft) 490 + { 491 + messageFlags |= MessageFlags.MSGFLAG_UNSENT; 492 + 493 + // Only set the IconIndex when it is not changed from NewEmail to something else 494 + if (IconIndex == MessageIconIndex.NewMail) 495 + IconIndex = MessageIconIndex.UnsentMail; 496 + } 497 + 498 + if (ReadRecipient) 499 + { 500 + TopLevelProperties.AddProperty(PropertyTags.PR_READ_RECEIPT_REQUESTED, true); 501 + var reportTag = new ReportTag {ANSIText = Subject}; 502 + TopLevelProperties.AddProperty(PropertyTags.PR_REPORT_TAG, reportTag.ToByteArray()); 503 + 504 + } 505 + 506 + TopLevelProperties.AddProperty(PropertyTags.PR_MESSAGE_FLAGS, messageFlags); 507 + TopLevelProperties.AddProperty(PropertyTags.PR_ICON_INDEX, IconIndex); 508 + 509 + Sender?.WriteProperties(TopLevelProperties); 510 + Receiving?.WriteProperties(TopLevelProperties); 511 + Representing?.WriteProperties(TopLevelProperties); 512 + ReceivingRepresenting?.WriteProperties(TopLevelProperties); 513 + 514 + if (recipientCount > 0) 515 + { 516 + var displayTo = new List<string>(); 517 + var displayCc = new List<string>(); 518 + var displayBcc = new List<string>(); 519 + 520 + foreach (var recipient in Recipients) 521 + { 522 + switch (recipient.RecipientType) 523 + { 524 + case RecipientType.To: 525 + if (!string.IsNullOrWhiteSpace(recipient.DisplayName)) 526 + displayTo.Add(recipient.DisplayName); 527 + else if (!string.IsNullOrWhiteSpace(recipient.Email)) 528 + displayTo.Add(recipient.Email); 529 + break; 530 + 531 + case RecipientType.Cc: 532 + if (!string.IsNullOrWhiteSpace(recipient.DisplayName)) 533 + displayCc.Add(recipient.DisplayName); 534 + else if (!string.IsNullOrWhiteSpace(recipient.Email)) 535 + displayCc.Add(recipient.Email); 536 + break; 537 + 538 + case RecipientType.Bcc: 539 + if (!string.IsNullOrWhiteSpace(recipient.DisplayName)) 540 + displayBcc.Add(recipient.DisplayName); 541 + else if (!string.IsNullOrWhiteSpace(recipient.Email)) 542 + displayBcc.Add(recipient.Email); 543 + break; 544 + 545 + default: 546 + throw new ArgumentOutOfRangeException(); 547 + } 548 + } 549 + 550 + var replyToRecipients = new List<string>(); 551 + 552 + foreach (var recipient in ReplyToRecipients) 553 + { 554 + replyToRecipients.Add(recipient.Email); 555 + } 556 + 557 + TopLevelProperties.AddProperty(PropertyTags.PR_DISPLAY_TO_W, string.Join(";", displayTo), PropertyFlags.PROPATTR_READABLE); 558 + TopLevelProperties.AddProperty(PropertyTags.PR_DISPLAY_CC_W, string.Join(";", displayCc), PropertyFlags.PROPATTR_READABLE); 559 + TopLevelProperties.AddProperty(PropertyTags.PR_DISPLAY_BCC_W, string.Join(";", displayBcc), PropertyFlags.PROPATTR_READABLE); 560 + TopLevelProperties.AddProperty(PropertyTags.PR_REPLY_RECIPIENT_NAMES_W, string.Join(";", replyToRecipients), PropertyFlags.PROPATTR_READABLE); 561 + } 562 + } 563 + #endregion 564 + 565 + #region Save 566 + /// <summary> 567 + /// Saves the message to the given <paramref name="stream" /> 568 + /// </summary> 569 + /// <param name="stream"></param> 570 + public new void Save(Stream stream) 571 + { 572 + WriteToStorage(); 573 + base.Save(stream); 574 + } 575 + 576 + /// <summary> 577 + /// Saves the message to the given <paramref name="fileName" /> 578 + /// </summary> 579 + /// <param name="fileName"></param> 580 + public new void Save(string fileName) 581 + { 582 + WriteToStorage(); 583 + base.Save(fileName); 584 + } 585 + #endregion 586 + 587 + #region Dispose 588 + /// <summary> 589 + /// Disposes all the attachment streams 590 + /// </summary> 591 + public new void Dispose() 592 + { 593 + foreach (var attachment in _attachments) 594 + attachment.Stream?.Dispose(); 595 + 596 + base.Dispose(); 597 + } 598 + #endregion 599 + } 600 + } -
1 + // 2 + // AddressBookEntryIdType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + namespace MsgKit.Enums 28 + { 29 + /// <summary> 30 + /// An integer representing the type of the object. It MUST be one of the values from the following table. 31 + /// </summary> 32 + public enum AddressBookEntryIdType 33 + { 34 + /// <summary> 35 + /// A local mail user 36 + /// </summary> 37 + LocalMailUser = 0x00000000, 38 + 39 + /// <summary> 40 + /// A distribution list 41 + /// </summary> 42 + DistributionList = 0x00000001, 43 + 44 + /// <summary> 45 + /// A bulletinboard or public folder 46 + /// </summary> 47 + BulletinBoardOrPublicFolder = 0x00000002, 48 + 49 + /// <summary> 50 + /// An automated mailbox 51 + /// </summary> 52 + AutomatedMailBox = 0x00000003, 53 + 54 + /// <summary> 55 + /// An organiztional mailbox 56 + /// </summary> 57 + OrganizationalMailBox = 0x00000004, 58 + 59 + /// <summary> 60 + /// A private distribtion list 61 + /// </summary> 62 + PrivateDistributionList = 0x00000005, 63 + 64 + /// <summary> 65 + /// A remote mail user 66 + /// </summary> 67 + RemoteMailUser = 0x00000006, 68 + 69 + /// <summary> 70 + /// A container 71 + /// </summary> 72 + Container = 0x00000100, 73 + 74 + /// <summary> 75 + /// A template 76 + /// </summary> 77 + Template = 0x00000101, 78 + 79 + /// <summary> 80 + /// One off user 81 + /// </summary> 82 + OneOffUser = 0x00000102, 83 + 84 + /// <summary> 85 + /// Search 86 + /// </summary> 87 + Search = 0x00000200 88 + } 89 + } -
1 + // 2 + // AddressType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + namespace MsgKit.Enums 28 + { 29 + /// <summary> 30 + /// Contains the messaging user's e-mail address type, such as SMTP. 31 + /// </summary> 32 + public enum AddressType 33 + { 34 + /// <summary> 35 + /// Unknown 36 + /// </summary> 37 + Unknown, 38 + 39 + /// <summary> 40 + /// Exchange 41 + /// </summary> 42 + Ex, 43 + 44 + /// <summary> 45 + /// Simple Mail Transfer Protocol 46 + /// </summary> 47 + Smtp, 48 + 49 + /// <summary> 50 + /// Fax 51 + /// </summary> 52 + Fax, 53 + 54 + /// <summary> 55 + /// MHS 56 + /// </summary> 57 + Mhs, 58 + 59 + /// <summary> 60 + /// PROFS 61 + /// </summary> 62 + Profs, 63 + 64 + /// <summary> 65 + /// X400 66 + /// </summary> 67 + X400 68 + } 69 + } 70 + -
1 + // ReSharper disable InconsistentNaming 2 + 3 + // 4 + // AppointmentState.cs 5 + // 6 + // Author: Kees van Spelde <[email protected]> 7 + // 8 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 9 + // 10 + // Permission is hereby granted, free of charge, to any person obtaining a copy 11 + // of this software and associated documentation files (the "Software"), to deal 12 + // in the Software without restriction, including without limitation the rights 13 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 + // copies of the Software, and to permit persons to whom the Software is 15 + // furnished to do so, subject to the following conditions: 16 + // 17 + // The above copyright notice and this permission notice shall be included in 18 + // all copies or substantial portions of the Software. 19 + // 20 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 23 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 + // THE SOFTWARE. 27 + // 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Valid values for the <see cref="NamedPropertyTags.PidLidAppointmentStateFlags "/> property 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/cc815362(v=office.15).aspx 36 + /// </remarks> 37 + public enum AppointmentState : uint 38 + { 39 + /// <summary> 40 + /// This flag indicates that the object is a meeting object or a meeting-related object. 41 + /// </summary> 42 + asfMeeting = 0x00000001, 43 + 44 + /// <summary> 45 + /// This flag indicates that the represented object was received from someone else. 46 + /// </summary> 47 + asfReceived = 0x00000002, 48 + 49 + /// <summary> 50 + /// This flag indicates that the meeting object represented by the object has been canceled. 51 + /// </summary> 52 + asfCanceled = 0x00000004, 53 + 54 + /// <summary> 55 + /// Full update. 56 + /// </summary> 57 + mtgInfo = 0x00020000, 58 + 59 + /// <summary> 60 + /// A newer meeting request or meeting update was received after this one. 61 + /// </summary> 62 + mtgOutOfDate = 0x00080000, 63 + 64 + /// <summary> 65 + /// This is set on the delegators copy when a delegate handles meeting-related objects. 66 + /// </summary> 67 + mtgDelegatorCopy = 0x00100000 68 + } 69 + } -
1 + // ReSharper disable InconsistentNaming 2 + 3 + // 4 + // AttachmentType.cs 5 + // 6 + // Author: Kees van Spelde <[email protected]> 7 + // 8 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 9 + // 10 + // Permission is hereby granted, free of charge, to any person obtaining a copy 11 + // of this software and associated documentation files (the "Software"), to deal 12 + // in the Software without restriction, including without limitation the rights 13 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 + // copies of the Software, and to permit persons to whom the Software is 15 + // furnished to do so, subject to the following conditions: 16 + // 17 + // The above copyright notice and this permission notice shall be included in 18 + // all copies or substantial portions of the Software. 19 + // 20 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 23 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 + // THE SOFTWARE. 27 + // 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Contains a bitmask of flags for an attachment. 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc765876(v=office.12) 36 + /// </remarks> 37 + public enum AttachmentFlags : uint 38 + { 39 + /// <summary> 40 + /// Indicates that this attachment is not available to HTML rendering applications and should be ignored in 41 + /// Multipurpose Internet Mail Extensions (MIME) processing. 42 + /// </summary> 43 + ATT_INVISIBLE_IN_HTML = 0x00000001, 44 + 45 + /// <summary> 46 + /// Indicates that this attachment is not available to applications rendering in Rich Text Format (RTF) and should be 47 + /// ignored by MAPI. 48 + /// </summary> 49 + ATT_INVISIBLE_IN_RTF = 0x00000002, 50 + 51 + /// <summary> 52 + /// The Attachment object is referenced and rendered within the HTML body of the associated Message object. 53 + /// </summary> 54 + ATT_MHTML_REF = 0x00000004 55 + } 56 + } -
1 + // ReSharper disable InconsistentNaming 2 + 3 + // 4 + // AttachmentType.cs 5 + // 6 + // Author: Kees van Spelde <[email protected]> 7 + // 8 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 9 + // 10 + // Permission is hereby granted, free of charge, to any person obtaining a copy 11 + // of this software and associated documentation files (the "Software"), to deal 12 + // in the Software without restriction, including without limitation the rights 13 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 + // copies of the Software, and to permit persons to whom the Software is 15 + // furnished to do so, subject to the following conditions: 16 + // 17 + // The above copyright notice and this permission notice shall be included in 18 + // all copies or substantial portions of the Software. 19 + // 20 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 23 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 + // THE SOFTWARE. 27 + // 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// The type of the attachment 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/office/cc815439.aspx 36 + /// </remarks> 37 + public enum AttachmentType : uint 38 + { 39 + /// <summary> 40 + /// There is no attachment 41 + /// </summary> 42 + NO_ATTACHMENT = 0x00000000, 43 + 44 + /// <summary> 45 + /// The <see cref="PropertyTags.PR_ATTACH_DATA_BIN" /> property contains the attachment data 46 + /// </summary> 47 + ATTACH_BY_VALUE = 0x00000001, 48 + 49 + /// <summary> 50 + /// The <see cref="PropertyTags.PR_ATTACH_PATHNAME_W" /> or <see cref="PropertyTags.PR_ATTACH_LONG_PATHNAME_W" /> 51 + /// property contains a fully qualified path identifying the attachment to recipients with access to a common file server 52 + /// </summary> 53 + ATTACH_BY_REFERENCE = 0x0002, 54 + 55 + /// <summary> 56 + /// The <see cref="PropertyTags.PR_ATTACH_PATHNAME_W" /> or <see cref="PropertyTags.PR_ATTACH_LONG_PATHNAME_W" /> 57 + /// property contains a fully qualified path identifying the attachment 58 + /// </summary> 59 + ATTACH_BY_REF_RESOLVE = 0x0003, 60 + 61 + /// <summary> 62 + /// The <see cref="PropertyTags.PR_ATTACH_PATHNAME_W" /> or <see cref="PropertyTags.PR_ATTACH_LONG_PATHNAME_W" /> 63 + /// property contains a fully qualified path identifying the attachment 64 + /// </summary> 65 + ATTACH_BY_REF_ONLY = 0x0004, 66 + 67 + /// <summary> 68 + /// The <see cref="PropertyTags.PR_ATTACH_DATA_OBJ" /> (PidTagAttachDataObject) property contains an embedded object 69 + /// that supports the IMessage interface 70 + /// </summary> 71 + ATTACH_EMBEDDED_MSG = 0x0005, 72 + 73 + /// <summary> 74 + /// The attachment is an embedded OLE object 75 + /// </summary> 76 + ATTACH_OLE = 0x0006, 77 + 78 + /// <summary> 79 + /// The <see cref="PropertyTags.PR_ATTACH_LONG_PATHNAME_W" /> property contains a fully qualified path identifying the attachment. 80 + /// The <see cref="PropertyTags.PR_NAME_A" /> PidNameAttachmentProviderType defines the web service API manipulating the attachment. 81 + /// </summary> 82 + ATTACH_BY_WEB_REFERENCE = 0x0007 83 + } 84 + } -
1 + // 2 + // MapiAccess.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + // ReSharper disable InconsistentNaming 29 + 30 + namespace MsgKit.Enums 31 + { 32 + /// <summary> 33 + /// Contains a bitmask of flags indicating the operations that are available to the client for the object. 34 + /// </summary> 35 + /// <remarks> 36 + /// See https://msdn.microsoft.com/en-us/library/office/cc979218.aspx 37 + /// This property is read-only for the client. It must be a bitwise OR of zero or more values from the following table. 38 + /// </remarks> 39 + [Flags] 40 + public enum MapiAccess : uint 41 + { 42 + /// <summary> 43 + /// Write 44 + /// </summary> 45 + MAPI_ACCESS_MODIFY = 0x00000001, 46 + 47 + /// <summary> 48 + /// Read 49 + /// </summary> 50 + MAPI_ACCESS_READ = 0x00000002, 51 + 52 + /// <summary> 53 + /// Delete 54 + /// </summary> 55 + MAPI_ACCESS_DELETE = 0x00000004, 56 + 57 + /// <summary> 58 + /// Create subfolders in the folder hierarchy 59 + /// </summary> 60 + MAPI_ACCESS_CREATE_HIERARCHY = 0x00000008, 61 + 62 + /// <summary> 63 + /// Create content messages 64 + /// </summary> 65 + MAPI_ACCESS_CREATE_CONTENTS = 0x00000010, 66 + 67 + /// <summary> 68 + /// Create associated content messages 69 + /// </summary> 70 + MAPI_ACCESS_CREATE_ASSOCIATED = 0x00000020 71 + } 72 + } 73 + -
1 + // 2 + // MapiObjectType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + 29 + // ReSharper disable InconsistentNaming 30 + 31 + namespace MsgKit.Enums 32 + { 33 + /// <summary> 34 + /// Contains the type of an object. 35 + /// </summary> 36 + /// <remarks> 37 + /// See https://msdn.microsoft.com/en-us/library/office/cc815487.aspx 38 + /// The object type contained in this property corresponds to the primary interface available for an object accessible 39 + /// through the OpenEntry interface. It is usually obtained by consulting the lpulObjType parameter returned by the 40 + /// appropriate OpenEntry method. When the interface is obtained in other ways, call IMAPIProp::GetProps to obtain the 41 + /// value for this property. 42 + /// </remarks> 43 + [Flags] 44 + public enum MapiObjectType : uint 45 + { 46 + /// <summary> 47 + /// Address book container object 48 + /// </summary> 49 + MAPI_ABCONT = 4, 50 + 51 + /// <summary> 52 + /// Address book object 53 + /// </summary> 54 + MAPI_ADDRBOOK = 2, 55 + 56 + /// <summary> 57 + /// Message attachment object 58 + /// </summary> 59 + MAPI_ATTACH = 7, 60 + 61 + /// <summary> 62 + /// Distribution list object 63 + /// </summary> 64 + MAPI_DISTLIST = 8, 65 + 66 + /// <summary> 67 + /// Folder object 68 + /// </summary> 69 + MAPI_FOLDER = 3, 70 + 71 + /// <summary> 72 + /// Form object 73 + /// </summary> 74 + MAPI_FORMINFO = 12, 75 + 76 + /// <summary> 77 + /// Messaging user object 78 + /// </summary> 79 + MAPI_MAILUSER = 6, 80 + 81 + /// <summary> 82 + /// Message object 83 + /// </summary> 84 + MAPI_MESSAGE = 5, 85 + 86 + /// <summary> 87 + /// Profile section object 88 + /// </summary> 89 + MAPI_PROFSECT = 9, 90 + 91 + /// <summary> 92 + /// Session object 93 + /// </summary> 94 + MAPI_SESSION = 11, 95 + 96 + /// <summary> 97 + /// Status object 98 + /// </summary> 99 + MAPI_STATUS = 10, 100 + 101 + /// <summary> 102 + /// Message store object 103 + /// </summary> 104 + MAPI_STORE = 1 105 + } 106 + } -
1 + // ReSharper disable InconsistentNaming 2 + 3 + // 4 + // MeetingType.cs 5 + // 6 + // Author: Kees van Spelde <[email protected]> 7 + // 8 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 9 + // 10 + // Permission is hereby granted, free of charge, to any person obtaining a copy 11 + // of this software and associated documentation files (the "Software"), to deal 12 + // in the Software without restriction, including without limitation the rights 13 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 + // copies of the Software, and to permit persons to whom the Software is 15 + // furnished to do so, subject to the following conditions: 16 + // 17 + // The above copyright notice and this permission notice shall be included in 18 + // all copies or substantial portions of the Software. 19 + // 20 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 23 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 + // THE SOFTWARE. 27 + // 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Valid values for the <see cref="NamedPropertyTags.PidLidMeetingType"/> property 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/cc815362(v=office.15).aspx 36 + /// </remarks> 37 + public enum MeetingType : uint 38 + { 39 + /// <summary> 40 + /// Unspecified. 41 + /// </summary> 42 + mtgEmpty = 0x00000000, 43 + 44 + /// <summary> 45 + /// nitial meeting request. 46 + /// </summary> 47 + mtgRequest = 0x00000001, 48 + 49 + /// <summary> 50 + /// Full update. 51 + /// </summary> 52 + mtgFull = 0x00010000, 53 + 54 + /// <summary> 55 + /// Full update. 56 + /// </summary> 57 + mtgInfo = 0x00020000, 58 + 59 + /// <summary> 60 + /// A newer meeting request or meeting update was received after this one. 61 + /// </summary> 62 + mtgOutOfDate = 0x00080000, 63 + 64 + /// <summary> 65 + /// This is set on the delegators copy when a delegate handles meeting-related objects. 66 + /// </summary> 67 + mtgDelegatorCopy = 0x00100000 68 + } 69 + } -
1 + // 2 + // MessageClass.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + namespace MsgKit.Enums 29 + { 30 + /// <summary> 31 + /// The MessageClass element is an optional element that specifies the message class of this e-mail message. 32 + /// </summary> 33 + /// <remarks> 34 + /// See https://msdn.microsoft.com/en-us/library/ee200767(v=exchg.80).aspx 35 + /// </remarks> 36 + public enum MessageClass 37 + { 38 + /// <summary> 39 + /// The message type is unknown 40 + /// </summary> 41 + Unknown, 42 + 43 + /// <summary> 44 + /// Normal e-mail message. 45 + /// </summary> 46 + IPM_Note, 47 + 48 + /// <summary> 49 + /// The message is encrypted and can also be signed. 50 + /// </summary> 51 + IPM_Note_SMIME, 52 + 53 + /// <summary> 54 + /// The message is clear signed. 55 + /// </summary> 56 + IPM_Note_SMIME_MultipartSigned, 57 + 58 + /// <summary> 59 + /// The message is a secure read receipt. 60 + /// </summary> 61 + IPM_Note_Receipt_SMIME, 62 + /// <summary> 63 + /// Post. 64 + /// </summary> 65 + IPM_Post, 66 + 67 + /// <summary> 68 + /// Octel voice message. 69 + /// </summary> 70 + IPM_Octel_Voice, 71 + 72 + /// <summary> 73 + /// Electronic voice notes. 74 + /// </summary> 75 + IPM_Voicenotes, 76 + 77 + /// <summary> 78 + /// Shared message. 79 + /// </summary> 80 + IPM_Sharing, 81 + 82 + /// <summary> 83 + /// Non-delivery report for a standard message. 84 + /// </summary> 85 + REPORT_IPM_NOTE_NDR, 86 + 87 + /// <summary> 88 + /// Delivery receipt for a standard message. 89 + /// </summary> 90 + REPORT_IPM_NOTE_DR, 91 + 92 + /// <summary> 93 + /// Delivery receipt for a delayed message. 94 + /// </summary> 95 + REPORT_IPM_NOTE_DELAYED, 96 + 97 + /// <summary> 98 + /// Read receipt for a standard message. 99 + /// </summary> 100 + REPORT_IPM_NOTE_IPNRN, 101 + 102 + /// <summary> 103 + /// Non-read receipt for a standard message. 104 + /// </summary> 105 + REPORT_IPM_NOTE_IPNNRN, 106 + 107 + /// <summary> 108 + /// Non-delivery report for a meeting request. 109 + /// </summary> 110 + REPORT_IPM_SCHEDULE_MEETING_REQUEST_NDR, 111 + 112 + /// <summary> 113 + /// Non-delivery report for a positive meeting response (accept). 114 + /// </summary> 115 + REPORT_IPM_SCHEDULE_MEETING_RESP_POS_NDR, 116 + 117 + /// <summary> 118 + /// Non-delivery report for a Tentative meeting response. 119 + /// </summary> 120 + REPORT_IPM_SCHEDULE_MEETING_RESP_TENT_NDR, 121 + 122 + /// <summary> 123 + /// Non-delivery report for a cancelled meeting notification. 124 + /// </summary> 125 + REPORT_IPM_SCHEDULE_MEETING_CANCELED_NDR, 126 + 127 + /// <summary> 128 + /// Non-delivery report for a Secure MIME (S/MIME) encrypted and opaque-signed message. 129 + /// </summary> 130 + REPORT_IPM_NOTE_SMIME_NDR, 131 + 132 + /// <summary> 133 + /// Delivery receipt for an S/MIME encrypted and opaque-signed message. 134 + /// </summary> 135 + REPORT_IPM_NOTE_SMIME_DR, 136 + 137 + /// <summary> 138 + /// Non-delivery report for an S/MIME clear-signed message. 139 + /// </summary> 140 + REPORT_IPM_NOTE_SMIME_MULTIPARTSIGNED_NDR, 141 + 142 + /// <summary> 143 + /// Delivery receipt for an S/MIME clear-signed message. 144 + /// </summary> 145 + REPORT_IPM_NOTE_SMIME_MULTIPARTSIGNED_DR, 146 + 147 + /// <summary> 148 + /// An appointment 149 + /// </summary> 150 + IPM_Appointment, 151 + 152 + /// <summary> 153 + /// Task 154 + /// </summary> 155 + IPM_Task, 156 + 157 + /// <summary> 158 + /// A contact 159 + /// </summary> 160 + IPM_Contact 161 + } 162 + } -
1 + // 2 + // MessageEditorFormat.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Specifies the format for an editor to use to display a message. 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/office/cc765727.aspx 36 + /// </remarks> 37 + public enum MessageEditorFormat 38 + { 39 + /// <summary> 40 + /// The format for the editor to use is unknown. 41 + /// </summary> 42 + EDITOR_FORMAT_DONTKNOW = 0x00000000, 43 + 44 + /// <summary> 45 + /// The editor should display the message in plain text format. 46 + /// </summary> 47 + EDITOR_FORMAT_PLAINTEXT = 0x00000001, 48 + 49 + /// <summary> 50 + /// The editor should display the message in HTML format. 51 + /// </summary> 52 + EDITOR_FORMAT_HTML = 0x00000002, 53 + 54 + /// <summary> 55 + /// The editor should display the message in Rich Text Format. 56 + /// </summary> 57 + EDITOR_FORMAT_RTF = 0x00000003 58 + } 59 + } -
1 + // 2 + // MessageFlags.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + // ReSharper disable InconsistentNaming 29 + 30 + namespace MsgKit.Enums 31 + { 32 + /// <summary> 33 + /// Contains a bitmask of flags that indicate the origin and current state of a message. 34 + /// </summary> 35 + /// <remarks> 36 + /// See https://msdn.microsoft.com/en-us/library/cc839733(v=office.15).aspx 37 + /// This property is a nontransmittable message property exposed at both the sending and receiving ends of a 38 + /// transmission, with different values depending upon the client application or store provider involved. This property 39 + /// is initialized by the client or message store provider when a message is created and saved for the first time and 40 + /// then updated periodically by the message store provider, a transport provider, and the MAPI spooler as the message 41 + /// is processed and its state changes. 42 + /// This property exists on a message both before and after submission, and on all copies of the received 43 + /// message. Although it is not a recipient property, it is exposed differently to each recipient according to whether 44 + /// it has been read or modified by that recipient. 45 + /// </remarks> 46 + [Flags] 47 + public enum MessageFlags : uint 48 + { 49 + /// <summary> 50 + /// The message is marked as having been read. This can occur as the result of a call at any time to 51 + /// IMessage::SetReadFlag or IMAPIFolder::SetReadFlags. Clients can also set this flag by calling a message's 52 + /// IMAPIProp::SetProps method before the message has been saved for the first time. This flag is ignored if the 53 + /// ASSOCIATED flag is set. 54 + /// </summary> 55 + MSGFLAG_READ = 0x0001, 56 + 57 + /// <summary> 58 + /// The outgoing message has not been modified since the first time that it was saved; the incoming message has not 59 + /// been modified since it was delivered. 60 + /// </summary> 61 + MSGFLAG_UNMODIFIED = 0x0002, 62 + 63 + /// <summary> 64 + /// The message is marked for sending as a result of a call to IMessage::SubmitMessage. Message store providers set 65 + /// this flag; the client has read-only access. 66 + /// </summary> 67 + MSGFLAG_SUBMIT = 0x0004, 68 + 69 + /// <summary> 70 + /// The message is still being composed. It is saved, but has not been sent. The client or provider has read/write 71 + /// access to this flag until the first IMAPIProp::SaveChanges call and read-only thereafter. If a client doesn't set 72 + /// this flag by the time the message is sent, the message store provider sets it when IMessage::SubmitMessage is 73 + /// called. Typically, this flag is cleared after the message is sent. 74 + /// </summary> 75 + MSGFLAG_UNSENT = 0x0008, 76 + 77 + /// <summary> 78 + /// The message has at least one attachment. This flag corresponds to the message's PR_HASATTACH (PidTagHasAttachments) 79 + /// property. The client has read-only access to this flag. 80 + /// </summary> 81 + MSGFLAG_HASATTACH = 0x0010, 82 + 83 + /// <summary> 84 + /// The messaging user sending was the messaging user receiving the message. The client or provider has read/write 85 + /// access to this flag until the first IMAPIProp::SaveChanges call and read-only thereafter. This flag is meant to be 86 + /// set by the transport provider. 87 + /// </summary> 88 + MSGFLAG_FROMME = 0x0020, 89 + 90 + /// <summary> 91 + /// The message is an associated message of a folder. The client or provider has read-only access to this flag. The 92 + /// READ flag is ignored for associated messages, which do not retain a read/unread state. 93 + /// </summary> 94 + MSGFLAG_ASSOCIATED = 0x040, 95 + 96 + /// <summary> 97 + /// The message includes a request for a resend operation with a nondelivery report. The client or provider has 98 + /// read/write access to this flag until the first IMAPIProp::SaveChanges call and read-only thereafter. 99 + /// </summary> 100 + MSGFLAG_RESEND = 0x0080, 101 + 102 + /// <summary> 103 + /// A read report needs to be sent for the message. The client or provider has read-only access to this flag. 104 + /// </summary> 105 + MSGFLAG_NOTIFYREAD = 0x100, 106 + 107 + /// <summary> 108 + /// A nonread report needs to be sent for the message. The client or provider has read-only access to this flag. 109 + /// </summary> 110 + MSGFLAG_NOTIFYUNREAD = 0x0200, 111 + 112 + /// <summary> 113 + /// The message has been read at least once. This flag is set or cleared by the server whenever the MSGFLAG_READ flag 114 + /// is set or cleared. 115 + /// </summary> 116 + MSGFLAG_EVERREAD = 0x0400, 117 + 118 + /// <summary> 119 + /// The incoming message arrived over an X.400 link. It originated either outside the organization or from a source the 120 + /// gateway cannot consider trusted. The client should display an appropriate message to the user. Transport providers 121 + /// set this flag; the client has read-only access. 122 + /// </summary> 123 + MSGFLAG_ORIGIN_X400 = 0x1000, 124 + 125 + /// <summary> 126 + /// The incoming message arrived over the Internet. It originated either outside the organization or from a source the 127 + /// gateway cannot consider trusted. The client should display an appropriate message to the user. Transport providers 128 + /// set this flag; the client has read-only access. 129 + /// </summary> 130 + MSGFLAG_ORIGIN_INTERNET = 0x2000, 131 + 132 + /// <summary> 133 + /// The incoming message arrived over an external link other than X.400 or the Internet. It originated either outside 134 + /// the organization or from a source the gateway cannot consider trusted. The client should display an appropriate 135 + /// message to the user. Transport providers set this flag; the client has read-only access. 136 + /// </summary> 137 + MSGFLAG_ORIGIN_MISC_EXT = 0x8000 138 + } 139 + } -
1 + // 2 + // MessageFormat.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + namespace MsgKit.Enums 28 + { 29 + /// <summary> 30 + /// The messageformat to use 31 + /// </summary> 32 + public enum MessageFormat 33 + { 34 + /// <summary> 35 + /// Send a plain text message body. 36 + /// </summary> 37 + TextOnly, 38 + 39 + /// <summary> 40 + /// Send an HTML message body. 41 + /// </summary> 42 + HtmlOnly, 43 + 44 + /// <summary> 45 + /// Send a multipart / alternative body with both plain text and HTML. 46 + /// </summary> 47 + TextAndHtml 48 + } 49 + } 50 + -
1 + // 2 + // MessageIconIndex.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Contains a number that indicates which icon to use when you display a group of e-mail objects. 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/cc815472(v=office.15).aspx 36 + /// This property, if it exists, is a hint to the client. The client may ignore the value of this property. 37 + /// </remarks> 38 + [Flags] 39 + public enum MessageIconIndex : uint 40 + { 41 + /// <summary> 42 + /// New mail 43 + /// </summary> 44 + NewMail = 0x00000000, 45 + 46 + /// <summary> 47 + /// Post 48 + /// </summary> 49 + Post = 0x00000001, 50 + 51 + /// <summary> 52 + /// Other 53 + /// </summary> 54 + Other = 0x00000003, 55 + 56 + /// <summary> 57 + /// Read mail 58 + /// </summary> 59 + ReadMail = 0x00000100, 60 + 61 + /// <summary> 62 + /// Unread mail 63 + /// </summary> 64 + UnreadMail = 0x00000101, 65 + 66 + /// <summary> 67 + /// Submitted mail 68 + /// </summary> 69 + SubmittedMail = 0x00000102, 70 + 71 + /// <summary> 72 + /// Unsent mail 73 + /// </summary> 74 + UnsentMail = 0x00000103, 75 + 76 + /// <summary> 77 + /// Receipt mail 78 + /// </summary> 79 + ReceiptMail = 0x00000104, 80 + 81 + /// <summary> 82 + /// Replied mail 83 + /// </summary> 84 + RepliedMail = 0x00000105, 85 + 86 + /// <summary> 87 + /// Forwarded mail 88 + /// </summary> 89 + ForwardedMail = 0x00000106, 90 + 91 + /// <summary> 92 + /// Remote mail 93 + /// </summary> 94 + RemoteMail = 0x00000107, 95 + 96 + /// <summary> 97 + /// Delivery receipt 98 + /// </summary> 99 + DeliveryReceipt = 0x00000108, 100 + 101 + /// <summary> 102 + /// Read receipt 103 + /// </summary> 104 + ReadReceipt = 0x00000109, 105 + 106 + /// <summary> 107 + /// Non delivery report 108 + /// </summary> 109 + NondeliveryReport = 0x0000010A, 110 + 111 + /// <summary> 112 + /// Non read receipt 113 + /// </summary> 114 + NonReadReceipt = 0x0000010B, 115 + 116 + /// <summary> 117 + /// Recall S mail 118 + /// </summary> 119 + RecallSMail = 0x0000010C, 120 + 121 + /// <summary> 122 + /// Recall F mail 123 + /// </summary> 124 + RecallFMail = 0x0000010D, 125 + 126 + /// <summary> 127 + /// Tracking mail 128 + /// </summary> 129 + TrackingMail = 0x0000010E, 130 + 131 + /// <summary> 132 + /// Out of office mail 133 + /// </summary> 134 + OutOfOfficeMail = 0x0000011B, 135 + 136 + /// <summary> 137 + /// Recall mail 138 + /// </summary> 139 + RecallMail = 0x0000011C, 140 + 141 + /// <summary> 142 + /// Tracked mail 143 + /// </summary> 144 + TrackedMail = 0x00000130, 145 + 146 + /// <summary> 147 + /// Contact 148 + /// </summary> 149 + Contact = 0x00000200, 150 + 151 + /// <summary> 152 + /// Distribution list 153 + /// </summary> 154 + DistributionList = 0x00000202, 155 + 156 + /// <summary> 157 + /// Sticky note blue 158 + /// </summary> 159 + StickyNoteBlue = 0x00000300, 160 + 161 + /// <summary> 162 + /// Sticky note green 163 + /// </summary> 164 + StickyNoteGreen = 0x00000301, 165 + 166 + /// <summary> 167 + /// Sticky note pink 168 + /// </summary> 169 + StickyNotePink = 0x00000302, 170 + 171 + /// <summary> 172 + /// Sticky note yellow 173 + /// </summary> 174 + StickyNoteYellow = 0x00000303, 175 + 176 + /// <summary> 177 + /// Sticky note white 178 + /// </summary> 179 + StickyNoteWhite = 0x00000304, 180 + 181 + /// <summary> 182 + /// Single instance appointment 183 + /// </summary> 184 + SingleInstanceAppointment = 0x00000400, 185 + 186 + /// <summary> 187 + /// Recurring appointment 188 + /// </summary> 189 + RecurringAppointment = 0x00000401, 190 + 191 + /// <summary> 192 + /// Single instance meeting 193 + /// </summary> 194 + SingleInstanceMeeting = 0x00000402, 195 + 196 + /// <summary> 197 + /// Recurring meeting 198 + /// </summary> 199 + RecurringMeeting = 0x00000403, 200 + 201 + /// <summary> 202 + /// Meeting request 203 + /// </summary> 204 + MeetingRequest = 0x00000404, 205 + 206 + /// <summary> 207 + /// Accept 208 + /// </summary> 209 + Accept = 0x00000405, 210 + 211 + /// <summary> 212 + /// Decline 213 + /// </summary> 214 + Decline = 0x00000406, 215 + 216 + /// <summary> 217 + /// Tentativly 218 + /// </summary> 219 + Tentativly = 0x00000407, 220 + 221 + /// <summary> 222 + /// Cancellation 223 + /// </summary> 224 + Cancellation = 0x00000408, 225 + 226 + /// <summary> 227 + /// Informational update 228 + /// </summary> 229 + InformationalUpdate = 0x00000409, 230 + 231 + /// <summary> 232 + /// Task/task 233 + /// </summary> 234 + TaskTask = 0x00000500, 235 + 236 + /// <summary> 237 + /// Unassigned recurring task 238 + /// </summary> 239 + UnassignedRecurringTask = 0x00000501, 240 + 241 + /// <summary> 242 + /// Assignee's task 243 + /// </summary> 244 + AssigneesTask = 0x00000502, 245 + 246 + /// <summary> 247 + /// Assigner's task 248 + /// </summary> 249 + AssignersTask = 0x00000503, 250 + 251 + /// <summary> 252 + /// Task request 253 + /// </summary> 254 + TaskRequest = 0x00000504, 255 + 256 + /// <summary> 257 + /// Task acceptance 258 + /// </summary> 259 + TaskAcceptance = 0x00000505, 260 + 261 + /// <summary> 262 + /// Task rejection 263 + /// </summary> 264 + TaskRejection = 0x00000506, 265 + 266 + /// <summary> 267 + /// Journal conversation 268 + /// </summary> 269 + JournalConversation = 0x00000601, 270 + 271 + /// <summary> 272 + /// Journal e-mail message 273 + /// </summary> 274 + JournalEmailMessage = 0x00000602, 275 + 276 + /// <summary> 277 + /// Journal meeting request 278 + /// </summary> 279 + JournalMeetingRequest = 0x00000603, 280 + 281 + /// <summary> 282 + /// Journal meeting response 283 + /// </summary> 284 + JournalMeetingResponse = 0x00000604, 285 + 286 + /// <summary> 287 + /// Journal task request 288 + /// </summary> 289 + JournalTaskRequest = 0x00000606, 290 + 291 + /// <summary> 292 + /// Journal task response 293 + /// </summary> 294 + JournalTaskResponse = 0x00000607, 295 + 296 + /// <summary> 297 + /// Journal note 298 + /// </summary> 299 + JournalNote = 0x00000608, 300 + 301 + /// <summary> 302 + /// Journal fax 303 + /// </summary> 304 + JournalFax = 0x00000609, 305 + 306 + /// <summary> 307 + /// Journal phone call 308 + /// </summary> 309 + JournalPhoneCall = 0x0000060A, 310 + 311 + /// <summary> 312 + /// Journal letter 313 + /// </summary> 314 + JournalLetter = 0x0000060C, 315 + 316 + /// <summary> 317 + /// Journal Microsoft Office Word 318 + /// </summary> 319 + JournalMicrosoftOfficeWord = 0x0000060D, 320 + 321 + /// <summary> 322 + /// Journal Microsoft Office Excel 323 + /// </summary> 324 + JournalMicrosoftOfficeExcel = 0x0000060E, 325 + 326 + /// <summary> 327 + /// Journal Microsoft Office PowerPoint 328 + /// </summary> 329 + JournalMicrosoftOfficePowerPoint = 0x0000060F, 330 + 331 + /// <summary> 332 + /// Journal Microsoft Office Access 333 + /// </summary> 334 + JournalMicrosoftOfficeAccess = 0x00000610, 335 + 336 + /// <summary> 337 + /// Journal document 338 + /// </summary> 339 + JournalDocument = 0x00000612, 340 + 341 + /// <summary> 342 + /// Journal meeting 343 + /// </summary> 344 + JournalMeeting = 0x00000613, 345 + 346 + /// <summary> 347 + /// Journal meeting cancellation 348 + /// </summary> 349 + JournalMeetingCancellation = 0x00000614, 350 + 351 + /// <summary> 352 + /// Journal remote session 353 + /// </summary> 354 + JournalRemoteSession = 0x00000615 355 + } 356 + } -
1 + // 2 + // MessageImportance.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + namespace MsgKit.Enums 29 + { 30 + /// <summary> 31 + /// Contains the relative priority of a message. 32 + /// </summary> 33 + /// <remarks> 34 + /// See https://msdn.microsoft.com/en-us/library/cc815346(v=office.15).aspx 35 + /// </remarks> 36 + public enum MessageImportance 37 + { 38 + /// <summary> 39 + /// The message has low importance. 40 + /// </summary> 41 + IMPORTANCE_LOW = 0, 42 + 43 + /// <summary> 44 + /// The message has normal importance. 45 + /// </summary> 46 + IMPORTANCE_NORMAL = 1, 47 + 48 + /// <summary> 49 + /// The message has high importance. 50 + /// </summary> 51 + IMPORTANCE_HIGH = 2 52 + } 53 + } -
1 + // 2 + // MessagePriority.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + namespace MsgKit.Enums 29 + { 30 + /// <summary> 31 + /// Contains a value that indicates the message sender's opinion of the importance of a message. 32 + /// </summary> 33 + /// <remarks> 34 + /// See https://msdn.microsoft.com/en-us/library/cc765646(v=office.15).aspx 35 + /// </remarks> 36 + public enum MessagePriority 37 + { 38 + /// <summary> 39 + /// The message is not urgent. 40 + /// </summary> 41 + PRIO_NONURGENT = 0, 42 + 43 + /// <summary> 44 + /// The message has normal priority. 45 + /// </summary> 46 + PRIO_NORMAL = 1, 47 + 48 + /// <summary> 49 + /// The message is urgent. 50 + /// </summary> 51 + PRIO_URGENT = 2 52 + } 53 + } -
1 + // ReSharper disable InconsistentNaming 2 + 3 + // 4 + // PostalAddressId.cs 5 + // 6 + // Author: Kees van Spelde <[email protected]> 7 + // 8 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 9 + // 10 + // Permission is hereby granted, free of charge, to any person obtaining a copy 11 + // of this software and associated documentation files (the "Software"), to deal 12 + // in the Software without restriction, including without limitation the rights 13 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 + // copies of the Software, and to permit persons to whom the Software is 15 + // furnished to do so, subject to the following conditions: 16 + // 17 + // The above copyright notice and this permission notice shall be included in 18 + // all copies or substantial portions of the Software. 19 + // 20 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 23 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 + // THE SOFTWARE. 27 + // 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Specifies which physical address is the contact's mailing address 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidpostaladdressid-canonical-property 36 + /// </remarks> 37 + public enum PostalAddressId : uint 38 + { 39 + /// <summary> 40 + /// No address is selected as the mailing address 41 + /// </summary> 42 + NO_ADDRESS = 0x00000000, 43 + 44 + /// <summary> 45 + /// The Home Address is the mailing address 46 + /// </summary> 47 + HOME_ADDRESS = 0x00000001, 48 + 49 + /// <summary> 50 + /// The Work Address is the mailing address. 51 + /// </summary> 52 + WORK_ADDRESS = 0x00000002, 53 + 54 + /// <summary> 55 + /// The Other Address is the mailing address 56 + /// </summary> 57 + OTHER_ADDRESS = 0x00000003, 58 + } 59 + } 60 + -
1 + // 2 + // PropertyFlags.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Flags used to set on a <see cref="Structures.Property" /> 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/ee158556(v=exchg.80).aspx 36 + /// </remarks> 37 + [Flags] 38 + public enum PropertyFlags : uint 39 + { 40 + // ReSharper disable InconsistentNaming 41 + /// <summary> 42 + /// If this flag is set for a property, that property MUST NOT be deleted from the .msg file 43 + /// (irrespective of which storage it is contained in) and implementations MUST return an error 44 + /// if any attempt is made to do so. This flag is set in circumstances where the implementation 45 + /// depends on that property always being present in the .msg file once it is written there. 46 + /// </summary> 47 + PROPATTR_MANDATORY = 0x00000001, 48 + 49 + /// <summary> 50 + /// If this flag is not set on a property, that property MUST NOT be read from the .msg file 51 + /// and implementations MUST return an error if any attempt is made to read it. This flag is 52 + /// set on all properties unless there is an implementation-specific reason to prevent a property 53 + /// from being read from the .msg file. 54 + /// </summary> 55 + PROPATTR_READABLE = 0x00000002, 56 + 57 + /// <summary> 58 + /// If this flag is not set on a property, that property MUST NOT be modified or deleted and 59 + /// implementations MUST return an error if any attempt is made to do so. This flag is set in 60 + /// circumstances where the implementation depends on the properties being writable. 61 + /// </summary> 62 + PROPATTR_WRITABLE = 0x00000004 63 + // ReSharper restore InconsistentNaming 64 + } 65 + } -
1 + // 2 + // PropertyKind.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Kind (1 byte): The possible values for the Kind field are in the following table. 33 + /// </summary> 34 + [Flags] 35 + public enum PropertyKind 36 + { 37 + /// <summary> 38 + /// The property is identified by the LID field (numerical named property) 39 + /// </summary> 40 + Lid = 0x00, 41 + 42 + /// <summary> 43 + /// The property is identified by the Name field (string named property) 44 + /// </summary> 45 + Name = 0x01, 46 + 47 + /// <summary> 48 + /// The property does not have an associated PropertyName field. 49 + /// </summary> 50 + NotAssociated = 0xFF 51 + } 52 + } -
1 + // 2 + // PropertyType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + namespace MsgKit.Enums 29 + { 30 + /// <summary> 31 + /// The type of a property in the properties stream 32 + /// </summary> 33 + public enum PropertyType : ushort 34 + { 35 + /// <summary> 36 + /// Any: this property type value matches any type; a server MUST return the actual type in its response. Servers 37 + /// MUST NOT return this type in response to a client request other than NspiGetIDsFromNames or the 38 + /// RopGetPropertyIdsFromNamesROP request ([MS-OXCROPS] section 2.2.8.1). (PT_UNSPECIFIED) 39 + /// </summary> 40 + PT_UNSPECIFIED = 0x0000, 41 + 42 + /// <summary> 43 + /// None: This property is a placeholder. (PT_NULL) 44 + /// </summary> 45 + PT_NULL = 0x0001, 46 + 47 + /// <summary> 48 + /// 2 bytes; a 16-bit integer (PT_I2, i2, ui2) 49 + /// </summary> 50 + PT_SHORT = 0x0002, 51 + 52 + /// <summary> 53 + /// 4 bytes; a 32-bit integer (PT_LONG, PT_I4, int, ui4) 54 + /// </summary> 55 + PT_LONG = 0x0003, 56 + 57 + /// <summary> 58 + /// 4 bytes; a 32-bit floating point number (PT_FLOAT, PT_R4, float, r4) 59 + /// </summary> 60 + PT_FLOAT = 0x0004, 61 + 62 + /// <summary> 63 + /// 8 bytes; a 64-bit floating point number (PT_DOUBLE, PT_R8, r8) 64 + /// </summary> 65 + PT_DOUBLE = 0x0005, 66 + 67 + /// <summary> 68 + /// 8 bytes; a 64-bit floating point number in which the whole number part represents the number of days since 69 + /// December 30, 1899, and the fractional part represents the fraction of a day since midnight (PT_APPTIME) 70 + /// </summary> 71 + PT_APPTIME = 0x0007, 72 + 73 + /// <summary> 74 + /// 4 bytes; a 32-bit integer encoding error information as specified in section 2.4.1. (PT_ERROR) 75 + /// </summary> 76 + PT_ERROR = 0x000A, 77 + 78 + /// <summary> 79 + /// 1 byte; restricted to 1 or 0 (PT_BOOLEAN. bool) 80 + /// </summary> 81 + PT_BOOLEAN = 0x000B, 82 + 83 + /// <summary> 84 + /// The property value is a Component Object Model (COM) object, as specified in section 2.11.1.5. (PT_OBJECT) 85 + /// </summary> 86 + PT_OBJECT = 0x000D, 87 + 88 + /// <summary> 89 + /// 8 bytes; a 64-bit integer (PT_LONGLONG, PT_I8, i8, ui8) 90 + /// </summary> 91 + PT_I8 = 0x0014, 92 + 93 + /// <summary> 94 + /// 8 bytes; a 64-bit integer (PT_LONGLONG, PT_I8, i8, ui8) 95 + /// </summary> 96 + PT_LONGLONG = 0x0014, 97 + 98 + /// <summary> 99 + /// Variable size; a string of Unicode characters in UTF-16LE format encoding with terminating null character 100 + /// (0x0000). (PT_UNICODE, string) 101 + /// </summary> 102 + PT_UNICODE = 0x001F, 103 + 104 + /// <summary> 105 + /// Variable size; a string of multibyte characters in externally specified encoding with terminating null 106 + /// character (single 0 byte). (PT_STRING8) ... ANSI format 107 + /// </summary> 108 + PT_STRING8 = 0x001E, 109 + 110 + /// <summary> 111 + /// 8 bytes; a 64-bit integer representing the number of 100-nanosecond intervals since January 1, 1601 112 + /// (PT_SYSTIME, time, datetime, datetime.tz, datetime.rfc1123, Date, time, time.tz) 113 + /// </summary> 114 + PT_SYSTIME = 0x0040, 115 + 116 + /// <summary> 117 + /// 16 bytes; a GUID with Data1, Data2, and Data3 fields in little-endian format (PT_CLSID, UUID) 118 + /// </summary> 119 + PT_CLSID = 0x0048, 120 + 121 + /// <summary> 122 + /// Variable size; a 16-bit COUNT field followed by a structure as specified in section 2.11.1.4. (PT_SVREID) 123 + /// </summary> 124 + PT_SVREID = 0x00FB, 125 + 126 + /// <summary> 127 + /// Variable size; a byte array representing one or more Restriction structures as specified in section 2.12. 128 + /// (PT_SRESTRICT) 129 + /// </summary> 130 + PT_SRESTRICT = 0x00FD, 131 + 132 + /// <summary> 133 + /// Variable size; a 16-bit COUNT field followed by that many rule (4) action (3) structures, as specified in 134 + /// [MS-OXORULE] section 2.2.5. (PT_ACTIONS) 135 + /// </summary> 136 + PT_ACTIONS = 0x00FE, 137 + 138 + /// <summary> 139 + /// Variable size; a COUNT field followed by that many bytes. (PT_BINARY) 140 + /// </summary> 141 + PT_BINARY = 0x0102, 142 + 143 + /// <summary> 144 + /// Variable size; a COUNT field followed by that many PT_MV_SHORT values. (PT_MV_SHORT, PT_MV_I2, mv.i2) 145 + /// </summary> 146 + PT_MV_SHORT = 0x1002, 147 + 148 + /// <summary> 149 + /// Variable size; a COUNT field followed by that many PT_MV_LONG values. (PT_MV_LONG, PT_MV_I4, mv.i4) 150 + /// </summary> 151 + PT_MV_LONG = 0x1003, 152 + 153 + /// <summary> 154 + /// Variable size; a COUNT field followed by that many PT_MV_FLOAT values. (PT_MV_FLOAT, PT_MV_R4, mv.float) 155 + /// </summary> 156 + PT_MV_FLOAT = 0x1004, 157 + 158 + /// <summary> 159 + /// Variable size; a COUNT field followed by that many PT_MV_DOUBLE values. (PT_MV_DOUBLE, PT_MV_R8) 160 + /// </summary> 161 + PT_MV_DOUBLE = 0x1005, 162 + 163 + /// <summary> 164 + /// Variable size; a COUNT field followed by that many PT_MV_CURRENCY values. (PT_MV_CURRENCY, mv.fixed.14.4) 165 + /// </summary> 166 + PT_MV_CURRENCY = 0x1006, 167 + 168 + /// <summary> 169 + /// Variable size; a COUNT field followed by that many PT_MV_APPTIME values. (PT_MV_APPTIME) 170 + /// </summary> 171 + PT_MV_APPTIME = 0x1007, 172 + 173 + /// <summary> 174 + /// Variable size; a COUNT field followed by that many PT_MV_LONGLONGvalues. (PT_MV_I8, PT_MV_I8) 175 + /// </summary> 176 + PT_MV_LONGLONG = 0x1014, 177 + 178 + /// <summary> 179 + /// Variable size; a COUNT field followed by that many PT_MV_UNICODE values. (PT_MV_UNICODE) 180 + /// </summary> 181 + PT_MV_TSTRING = 0x101F, 182 + 183 + /// <summary> 184 + /// Variable size; a COUNT field followed by that many PT_MV_UNICODE values. (PT_MV_UNICODE) 185 + /// </summary> 186 + PT_MV_UNICODE = 0x101F, 187 + 188 + /// <summary> 189 + /// Variable size; a COUNT field followed by that many PT_MV_STRING8 values. (PT_MV_STRING8, mv.string) 190 + /// </summary> 191 + PT_MV_STRING8 = 0x101E, 192 + 193 + /// <summary> 194 + /// Variable size; a COUNT field followed by that many PT_MV_SYSTIME values. (PT_MV_SYSTIME) 195 + /// </summary> 196 + PT_MV_SYSTIME = 0x1040, 197 + 198 + /// <summary> 199 + /// Variable size; a COUNT field followed by that many PT_MV_CLSID values. (PT_MV_CLSID, mv.uuid) 200 + /// </summary> 201 + PT_MV_CLSID = 0x1048, 202 + 203 + /// <summary> 204 + /// Variable size; a COUNT field followed by that many PT_MV_BINARY values. (PT_MV_BINARY, mv.bin.hex) 205 + /// </summary> 206 + PT_MV_BINARY = 0x1102, 207 + } 208 + } -
1 + // 2 + // RecipientFlags.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using System; 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// Specifies a bit field that describes the recipient status. 33 + /// </summary> 34 + /// <remarks> 35 + /// See https://msdn.microsoft.com/en-us/library/office/cc815629.aspx 36 + /// </remarks> 37 + [Flags] 38 + public enum RecipientFlags : uint 39 + { 40 + /// <summary> 41 + /// The recipient is a Sendable Attendee. This flag is only used in the dispidApptUnsendableRecips 42 + /// (PidLidAppointmentUnsendableRecipients) property. 43 + /// </summary> 44 + RecipSendable = 0x00000001, 45 + 46 + /// <summary> 47 + /// The RecipientRow on which this flag is set represents the meeting Organizer. 48 + /// </summary> 49 + RecipOrganizer = 0x0000002, 50 + 51 + /// <summary> 52 + /// Indicates that the attendee gave a response for the exception on which this RecipientRow resides. This flag is only 53 + /// used in a RecipientRow of an exception embedded message object of the organizers meeting object. 54 + /// </summary> 55 + RecipExceptionalResponse = 0x00000010, 56 + 57 + /// <summary> 58 + /// Indicates that although the RecipientRow exists, it should be treated as if the corresponding recipient does not. 59 + /// This flag is only used in a RecipientRow of an exception embedded message object of the organizers meeting object. 60 + /// </summary> 61 + RecipExceptionalDeleted = 0x00000020, 62 + 63 + /// <summary> 64 + /// Indicates the recipient is an original attendee. This flag is only used in the dispidApptUnsendableRecips property. 65 + /// </summary> 66 + RecipOriginal = 0x00000100 67 + } 68 + } -
1 + // 2 + // RecipientRowAddressType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + using MsgKit.Structures; 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// The <see cref="RecipientRow.RecipientRowDisplayType" /> 33 + /// </summary> 34 + public enum RecipientRowAddressType 35 + { 36 + /// <summary> 37 + /// No type is set 38 + /// </summary> 39 + NoType = 0x0, 40 + 41 + /// <summary> 42 + /// X500DN 43 + /// </summary> 44 + X500Dn = 0x1, 45 + 46 + /// <summary> 47 + /// Ms mail 48 + /// </summary> 49 + MsMail = 0x2, 50 + 51 + /// <summary> 52 + /// SMTP 53 + /// </summary> 54 + Smtp = 0x3, 55 + 56 + /// <summary> 57 + /// Fax 58 + /// </summary> 59 + Fax = 0x4, 60 + 61 + /// <summary> 62 + /// Professional office system 63 + /// </summary> 64 + ProfessionalOfficeSystem = 0x5, 65 + 66 + /// <summary> 67 + /// Personal distribution list 1 68 + /// </summary> 69 + PersonalDistributionList1 = 0x6, 70 + 71 + /// <summary> 72 + /// Personal distribution list 2 73 + /// </summary> 74 + PersonalDistributionList2 = 0x7 75 + } 76 + } -
-
-
1 + // 2 + // RecurrencePatternCalendarType.cs 3 + // 4 + // Author: Kees van Spelde <[email protected]> 5 + // 6 + // Copyright (c) 2015-2021 Magic-Sessions. (www.magic-sessions.com) 7 + // 8 + // Permission is hereby granted, free of charge, to any person obtaining a copy 9 + // of this software and associated documentation files (the "Software"), to deal 10 + // in the Software without restriction, including without limitation the rights 11 + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 + // copies of the Software, and to permit persons to whom the Software is 13 + // furnished to do so, subject to the following conditions: 14 + // 15 + // The above copyright notice and this permission notice shall be included in 16 + // all copies or substantial portions of the Software. 17 + // 18 + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 + // FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 21 + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 + // THE SOFTWARE. 25 + // 26 + 27 + // ReSharper disable InconsistentNaming 28 + 29 + namespace MsgKit.Enums 30 + { 31 + /// <summary> 32 + /// An integer that specifies the type of calendar that is used. The acceptable values for the calendar type are listed 33 + /// in the following table. 34 + /// </summary> 35 + /// <remarks> 36 + /// See https://msdn.microsoft.com/en-us/library/ee203303(v=exchg.80).aspx 37 + /// </remarks> 38 + public enum RecurrencePatternCalendarType 39 + { 40 + /// <summary> 41 + /// The default value for the calendar type is Gregorian. 42 + /// If the value of the PatternType field is HjMonth, HjMonthNth, or HjMonthEnd and the value of the CalendarType field 43 + /// is Default, this recurrence uses the Hijri calendar. 44 + /// </summary> 45 + Default = 0x0000, 46 + 47 + /// <summary> 48 + /// Gregorian (localized) calendar 49 + /// </summary> 50 + CAL_GREGORIAN = 0x0001, 51 + 52 + /// <summary> 53 + /// Gregorian (U.S.) calendar 54 + /// </summary> 55 + CAL_GREGORIAN_US = 0x0002, 56 + 57 + /// <summary> 58 + /// Japanese Emperor era calendar 59 + /// </summary> 60 + CAL_JAPAN = 0x0003, 61 + 62 + /// <summary> 63 + /// Taiwan calendar 64 + /// </summary> 65 + CAL_TAIWAN = 0x0004, 66 + 67 + /// <summary> 68 + /// Korean Tangun era calendar 69 + /// </summary> 70 + CAL_KOREA = 0x0005, 71 + 72 + /// <summary> 73 + /// Hijri (Arabic Lunar) calendar 74 + /// </summary> 75 + CAL_HIJRI = 0x0006, 76 + 77 + /// <summary> 78 + /// Thai calendar 79 + /// </summary> 80 + CAL_THAI = 0x0007, 81 + 82 + /// <summary> 83 + /// Hebrew lunar calendar 84 + /// </summary> 85 + CAL_HEBREW = 0x0008, 86 + 87 + /// <summary> 88 + /// Gregorian Middle East French calendar 89 + /// </summary> 90 + CAL_GREGORIAN_ME_FRENCH = 0x0009, 91 + 92 + /// <summary> 93 + /// Gregorian Arabic calendar 94 + /// </summary> 95 + CAL_GREGORIAN_ARABIC = 0x000A, 96 + 97 + /// <summary> 98 + /// Gregorian transliterated English calendar 99 + /// </summary> 100 + CAL_GREGORIAN_XLIT_ENGLISH = 0x000B, 101 + 102 + /// <summary> 103 + /// Gregorian transliterated French calendar 104 + /// </summary> 105 + CAL_GREGORIAN_XLIT_FRENCH = 0x000C, 106 + 107 + /// <summary> 108 + /// Japanese lunar calendar 109 + /// </summary> 110 + CAL_LUNAR_JAPANESE = 0x000E, 111 + 112 + /// <summary> 113 + /// Chinese lunar calendar 114 + /// </summary> 115 + CAL_CHINESE_LUNAR = 0x000F, 116 + 117 + /// <summary> 118 + /// Saka era calendar 119 + /// </summary> 120 + CAL_SAKA = 0x0010, 121 + 122 + /// <summary> 123 + /// Lunar ETO Chinese calendar 124 + /// </summary> 125 + CAL_LUNAR_ETO_CHN = 0x0011, 126 + 127 + /// <summary> 128 + /// Lunar ETO Korean calendar 129 + /// </summary> 130 + CAL_LUNAR_ETO_KOR = 0x0012, 131 + 132 + /// <summary> 133 + /// Lunar Rokuyou calendar 134 + /// </summary> 135 + CAL_LUNAR_ROKUYOU = 0x0013, 136 + 137 + /// <summary> 138 + /// Korean lunar calendar 139 + /// </summary> 140 + CAL_LUNAR_KOREAN = 0x0014, 141 + 142 + /// <summary> 143 + /// Um Al Qura calendar 144 + /// </summary> 145 + CAL_UMALQURA = 0x0017 146 + } 147 + }