5

When I save an email (with attachments) to SharePoint from Outlook, I would like to see an indicator that lets me know that there are attachments on the email. I am aware that I can save the attachments separately.

What I am looking for is visual and very simple. Is there a way to enable the paperclip icon in SharePoint to let me know there are attachments on the email I saved?

  • There is no out of the box solution that SharePoint set that type of flags. But you can achieve using Visual Studio Item Event Reciever solution. Is it the on-premises site? And is your organizations allows Visual Studio solutions? I will give you snippet that can be used in VS solition. – Venkat Konjeti Jun 21 '17 at 4:04
0

You need to override EmailReceived to know the attachment if any.

Below is the sample code that you can use in your event receiver. I have added two new columns in my list that will receive the email to know the total attachments and also the file names attached in the email. TotalAttachments and AttachedFiles.

    SPEmailAttachmentCollection attachColl = emailMessage.Attachments;
    string AttachedFiles = string.Empty;
    int TotalAttachments = 0;
    foreach (SPEmailAttachment attach in attachColl)
    {
        AttachedFiles += attach.FileName + ";";
        TotalAttachments ++;
    }

Update the list with the columns "TotalAttachments" and "AttachedFiles"

    SPItem item = file.Item;
    item["TotalAttachments"] = TotalAttachments.ToString();
    item["AttachedFiles"] = AttachedFiles.ToString();
    item.Update();
    list.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.