Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, in order to resolve this, you need jQuery 1.7.x+ and the <a href="http://spservices.codeplex.com/" rel="nofollow">SPServices jQuery library</a> version 0.7.2 or greater installed on your site.</p> <p>Use <a href="http://spservices.codeplex.com/wikipage?title=GetListItems&amp;referringTitle=Lists" rel="nofollow">GetListItems</a> as the operation from SPServices.</p> <p>I'm searching for pages within the Pages directory, so listName is "Pages".</p> <p>The CAML View Fields are basically the columns for PublishingContactEmail and PublishingContact. I found those using <a href="http://www.u2u.be/res/tools/camlquerybuilder.aspx" rel="nofollow">u2u's CAML builder version 4.0.0.0</a></p> <p>The ows_ variables can be found in the xml view of the POST object in firebug.</p> <p>The ows_PublishingContact returns a long nasty string of the contact's information. Fortunately the email address is surrounded by <code>,#</code>, which made splitting it into an array and then searching for an email @ easy, but that's why that's there.</p> <pre><code>function get_page_contact_email() { var thisPageID = _spPageContextInfo.pageItemId; var e; $().SPServices({ operation: "GetListItems", async: false, listName: "Pages", CAMLViewFields: "&lt;ViewFields&gt;&lt;FieldRef Name='PublishingContactEmail' /&gt;&lt;FieldRef Name='PublishingContact' /&gt;&lt;/ViewFields&gt;", CAMLQueryOptions: "&lt;QueryOptions&gt;&lt;ExpandUserField&gt;True&lt;/ExpandUserField&gt;&lt;/QueryOptions&gt;", 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"); } else if ($(this).attr("ows_PublishingContact")) { //otherwise use contact info var contact = $(this).attr("ows_PublishingContact").split(",#"); for (var c = 0; c &lt; contact.length; c++) { if (contact[c].indexOf("@") != -1) { e = contact[c]; } } } else { //or nothing is set. e = false; } } }); } }); return e; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload