public ImageAttachment(string imageName, string imageId, string contentType, byte[] bytes = null) { ArgumentValidator.ThrowIfNullOrEmpty("imageName", imageName); ArgumentValidator.ThrowIfNullOrEmpty("imageId", imageId); ArgumentValidator.ThrowIfNullOrEmpty("contentType", contentType); this.ImageName = imageName; this.ImageId = imageId; this.contentType = contentType; this.bytes = (bytes ?? ImageAttachment.ReadImageFromEmbeddedResources(imageName)); }
private static ImageAttachment GetADThumbnailPhoto(ADRecipient adUser, string imageId, string imageName) { ImageAttachment result = null; if (adUser != null && adUser.ThumbnailPhoto != null && adUser.ThumbnailPhoto.Length > 0) { WelcomeToGroupMessageTemplate.Tracer.TraceDebug <ADRecipient>(0L, "WelcomeToGroupMessageTemplate.GetADThumbnailPhoto: Found thumbnail photo for {0}", adUser); result = new ImageAttachment(imageName, imageId, "image/jpeg", adUser.ThumbnailPhoto); } else { WelcomeToGroupMessageTemplate.Tracer.TraceDebug <ADRecipient>(0L, "WelcomeToGroupMessageTemplate.GetADThumbnailPhoto: No thumbnail photo found for {0}.", adUser); } return(result); }