0

I want to send an email when a new document is added to a folder in a Document Library using workflow. The email should be sent to the people who created and assigned to the particular folder. Is there any way I can do that?

looking forward to a suggestion.

Regrads, Aparupa

1

In SharePoint Designer you can create Email (condition/action) workflow to that library. Create a workflow with start option Automatically start this workflow when a new item is created. In that workflow you can select Email in ribbon and give the action To whom mail to be sent.

Check This Link

0

You can use workflow to send email when document is added to folder or document library. You need to check contenttype of document if it is folder then no need to send email otherwise send email to user or anyone.

  • Thanks for your reply. but it could be subfolders too inside a folder. And there would be many folders with different created by and assigned to users. so when any subfolder or document is added inside a folder, that particular created by and assigned to of the folder should get email. I hope it describes better now. I am very new to sharepoint and dont know how to process this. Any help would be highly appreciated. – Aparupa sengupta Sep 11 '17 at 9:33
0

I dont know if it is really necessary to do it with a workflow.

My idea is to realize this with help of an Event Receiver.

I did something similiar in the past. Therefore I wrote an EventReceiver with the following Event:

public override void ItemAdded(SPItemEventProperties properties)
{
    try
    {
        if(properties.ListItem.File.CheckOutType == SPFile.SPCheckOutType.None)
        {

            int listNameID = GetListNameID(properties.ListTitle, properties.WebUrl, properties.OpenSite());

            if (listNameID != 0)
            {
                if (properties.ListItem.FileSystemObjectType != SPFileSystemObjectType.Folder &&
                    properties.ListItem.FileSystemObjectType != SPFileSystemObjectType.Invalid)
                {
                    Classes.MailMetaData metaData = new Classes.MailMetaData();
                    metaData.EventType = "ADD";
                    metaData.DocumentLink = (string)properties.ListItem[SPBuiltInFieldId.EncodedAbsUrl];
                    metaData.TriggerTimestamp = DateTime.Now;
                    metaData.DocumentName = properties.ListItem.File.Name;
                    metaData.ListName = properties.ListTitle;
                    metaData.ChangeUserName = properties.UserDisplayName;
                    metaData.ItemID = properties.ListItemId;
                    metaData.WebURL = properties.WebUrl;
                    metaData.ListNameID = listNameID;
                    InsertDatabase(metaData, properties.OpenSite());
                }
            }
        }



    }
    catch (Exception ex)
    {
        SendErrorMail(string.Format("Error while handling ADD for item with ID '{0}', FileName '{1}' under '{2}' from User '{3}'.", properties.ListItemId.ToString(), properties.ListItem.File.Name, properties.WebUrl, properties.UserDisplayName), ex);
    }

    base.ItemAdded(properties);
}

Where GetListeNameID gets the ID of the list (custom method) and MailMetaData is a custom class aswell. My method InsertDatabase will put the data into a database which will be chekced by a QuartzJob every 15 minutes. This job handles my sending of the E-Mail.

Of course, you can handle the sending of the e-mail directly in the event receiver. I just did it for SoC.

Hope it helps.

  • Hey Chris, It looks very nice though I only have access to sharepoint designer and Infopath to change something. NO access to VB :( – Aparupa sengupta Sep 11 '17 at 9:38
  • Hi Aparupa, thats pretty sad. My Solution only works if you have the permission to deploy WebParts and are able to develop them :( – Chris K Sep 12 '17 at 10:17

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.