Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Access Page Owner contact email?

True, true, though that then requires a bit more functional writing to get the url path. Maybe one extra line of code, but probably another half hour of testing.

Anyway, late last night I finished the function. I haven't had a chance to test it to see if it works for anonymous users—that's a new question for anyone who knows: Does the SPServices call for the GetListItems work for an internet/extranet facing sharepoint site with anonymous (public) users?

function get_page_contact_email() {var thisPageID = _spPageContextInfo.pageItemId;var e;
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "Pages",
        CAMLViewFields: "<ViewFields><FieldRef Name='PublishingContactEmail' /><FieldRef Name='PublishingContact' /></ViewFields>",
        CAMLQueryOptions: "<QueryOptions><ExpandUserField>True</ExpandUserField></QueryOptions>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {if (thisPageID == $(this).attr("ows_ID")) {if ($(this).attr("ows_PublishingContactEmail")) { // if page email is set
                        e = $(this).attr("ows_PublishingContactEmail");
                    } elseif ($(this).attr("ows_PublishingContact")) { //otherwise use contact infovar contact = $(this).attr("ows_PublishingContact").split(",#");for (var c = 0; c < contact.length; c++) {if (contact[c].indexOf("@") != -1) {
                                e = contact[c];
                            }
                        }
                    } else { //or nothing is set.
                        e = false;
                    }
                }
            });
        }
    });return e;
}


Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>