OK、これを解決するには、jQuery1.7.x+とSPServicesjQueryライブラリバージョン0.7.2以降がサイトにインストールされている必要があります。
SPServicesからの操作としてGetListItemsを使用します。
Pagesディレクトリ内でページを検索しているので、listNameは「Pages」です。
CAMLビューフィールドは、基本的にPublishingContactEmailとPublishingContactの列です。u2uのCAMLビルダーバージョン4.0.0.0を使用しているものを見つけました
ows_変数は、firebugのPOSTオブジェクトのxmlビューにあります。
ows_PublishingContactは、連絡先の情報の長い厄介な文字列を返します。幸い、メールアドレスはで囲まれ,#
ているため、配列に分割してメールを簡単に検索できますが、それが理由です。
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");
} else if ($(this).attr("ows_PublishingContact")) { //otherwise use contact info
var 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;
}