none
In sp2013, In email click on hyperlink(have querystring) how to navigate to the selected folder/item with chekbox selection. RRS feed

  • Question

  •  As per the scenario, i implemented the Delete functionality on document Library. If  users need to delete their folder/item, Custom Delete button is provided. Click on Delete then mail sent to Owner of that Site with Hyperlink (have querystring). 

    Ex:

       Email Body :   

    body = 'Hi '+userName + '<br>' + loggedInUser + 'is need to delete '+ fileName+' Document Folder/Item.<br/>

    <a  href= "https://myteams.aaa.com/sites/ProductTracker/TrackerDev2/Documents/Forms/AllItems.aspx?RootFolder='+ RootFolder +'"> Click Here For Deletion

    </a>';

    Now my requirement is after click on the above link it should navigate to the Documents folder and checked the folder/item which user click on Delete. How to do this through either jquery or javascript? then after how to send mail to the user after delete the folder. 


    Wednesday, August 1, 2018 4:06 PM

All replies

  • Hi,

    You could add source parameter to URL as return url, for example:

    https://myteams.aaa.com/sites/ProductTracker/TrackerDev2/Documents/Forms/AllItems.aspx?RootFolder='+ RootFolder +'&source=’return url’

    For sending email, you could use /_api/SP.Utilities.Utility.SendEmail.

    function sendEmail(from, to, body, subject) {
        var urlTemplate = site + "/_api/SP.Utilities.Utility.SendEmail";
        var formDigest = document.getElementById("__REQUESTDIGEST").value;
        $j.ajax({
            contentType: 'application/json',
            url: urlTemplate,
            type: 'POST',
            data: JSON.stringify({
                'properties': {
                    '__metadata': { 'type': 'SP.Utilities.EmailProperties' },
                    'From': from,
                    'To': { 'results': [to] },
                    'Subject': subject,
                    'Body': body
                }
            }
          ),
            headers: {
                "Accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose",
                "X-RequestDigest": formDigest
            },
            success: function (data) {
                var result = data.d.results;
                var i = result.length;
            },
            error: function (err) {
                alert(JSON.stringify(err));
            }
        });
    }

    Here is one thread for your reference.

    https://wiki.base22.com/btg/send-email-in-sharepoint-2013-using-javascript-81796035.html

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, August 2, 2018 1:42 AM
  • HI Lee,

    I have a title, Fileref, FileLeafRef currently in the url as Querystring params.In that case based on the Fileref/FileLeafRef how to check the previous selected folder/item after redirect link from mail?

    Returen url part i didn't get it. can you elaborate with an example? 

    If we add it as query string, in that case previous folder/Item would checked (checkbox id : item.chx)?

    Friday, August 3, 2018 7:18 AM
  • Hi,

    If you’re using JSOM, you could get from

    _spPageContextInfo.webAbsoluteUrl

    Provide more details if you need furture help.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, August 6, 2018 7:46 AM
  • Hi Lee,

    I have to select the particular folder or item based on Query string after Rediect to Documents Library.

    How is it possible?

    Monday, August 6, 2018 9:22 AM