本文整理汇总了TypeScript中sp-pnp-js.Logger.write方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Logger.write方法的具体用法?TypeScript Logger.write怎么用?TypeScript Logger.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp-pnp-js.Logger
的用法示例。
在下文中一共展示了Logger.write方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
}).catch((errorMesssage) => {
this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
this.wait(false);
this.initialize([]);
Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
});
示例2: getTermById
/**
* Get a single term by its Id using the current taxonomy context.
* @param {SP.Guid} termId The taxonomy term Id
* @return {Promise<SP.Taxonomy.Term>} A promise containing the term infos.
*/
public getTermById(termId: SP.Guid): Promise<SP.Taxonomy.Term> {
if (termId) {
const context: SP.ClientContext = SP.ClientContext.get_current();
const taxSession: SP.Taxonomy.TaxonomySession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
const termStore: SP.Taxonomy.TermStore = taxSession.getDefaultSiteCollectionTermStore();
termStore.set_workingLanguage(this.workingLanguage);
const term: SP.Taxonomy.Term = termStore.getTerm(termId);
context.load(term, "Name");
const p = new Promise<SP.Taxonomy.Term>((resolve, reject) => {
context.executeQueryAsync(() => {
resolve(term);
}, (sender, args) => {
reject("Request failed. " + args.get_message() + "\n" + args.get_stackTrace());
});
});
return p;
} else {
Logger.write("[TaxonomyModule.getTermById]: the provided term id is null!", LogLevel.Error);
}
}
示例3: SearchNavigationNode
}).then((response) => {
if (response.ok) {
response.json().then((data: any) => {
const nodes: ISearchNavigationNode[] = data.d.results.map((elt) => {
let url = elt.Url;
if (!Util.isUrlAbsolute(url)) {
// IE fix
let origin = window.location.origin;
if (!origin) {
origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
}
url = Util.combinePaths(origin, url);
}
return new SearchNavigationNode(elt.Title, url);
});
resolve(nodes);
});
} else {
Logger.write("[SearchModule.getSearchNavigationSettings()] Error: " + response.statusText, LogLevel.Error);
reject();
}
});
示例4: getNavigationNodes
private getNavigationNodes(termSetId: string): void {
if (!termSetId) {
Logger.write("[FooterLinks.getNavigationNodes]: The term set id for the footer links is null. Please specify a valid term set id in the configuration list", LogLevel.Error);
} else {
// Ensure all SP dependencies are loaded before retrieving navigation nodes
this.taxonomyModule.init().then(() => {
// Initialize the main menu with taxonomy terms
this.taxonomyModule.getNavigationTaxonomyNodes(new SP.Guid(termSetId)).then((navigationTree) => {
// Initialize the mainMenu view model
this.initialize(navigationTree);
this.wait(false);
const now: Date = new Date();
// Set the navigation tree in the local storage of the browser
storage.local.put(this.localStorageKey, this.utilityModule.stringifyTreeObject(navigationTree), new Date(now.setDate(now.getDate() + 7)));
}).catch((errorMesssage) => {
Logger.write("[FooterLinks.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
});
}).catch((errorMesssage) => {
Logger.write("[FooterLinks.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
});
}
}
示例5:
web.lists.getById(_spPageContextInfo.pageListId.replace(/{|}/g, "")).items.getById(_spPageContextInfo.pageItemId).select(this.siteMapFieldName).get().then((item) => {
const siteMapTermGuid = item[this.siteMapFieldName];
let currentNode: TaxonomyNavigationNode;
if (siteMapTermGuid) {
// 1: Search for this guid in the site map
currentNode = this.utilityModule.getNodeByTermId(navigationTree, siteMapTermGuid.TermGuid);
}
if (currentNode === undefined) {
// 2: Get the navigation node according to the current URL
currentNode = this.utilityModule.getNodeByUrl(navigationTree, window.location.pathname);
}
if (currentNode !== undefined) {
// If there is no 'ParentId', this is a root term
if (currentNode.ParentId !== null) {
const parentNode = this.utilityModule.getNodeByTermId(navigationTree, currentNode.ParentId);
// Set the parent section
this.parentSection(parentNode);
if (parentNode.ChildNodes.length > 0) {
// Display all siblings and child nodes from the current node (just like the CSOM results)
// Siblings = children of my own parent ;)
navigationTree = parentNode.ChildNodes;
// Set the current node as first item
navigationTree = this.utilityModule.moveItem(navigationTree, navigationTree.indexOf(currentNode), 0);
}
}
} else {
Logger.write("[ContextualMenu.subscribe]: Unable to determine the current position in the site map", LogLevel.Warning);
}
this.initialize(navigationTree);
this.wait(false);
if (currentNode !== undefined) {
this.setCurrentNode(currentNode.Id);
}
// Truncate links
$("#contextualmenu a").trunk8({
lines: 3,
tooltip: true,
});
}).catch((errorMesssage) => {
示例6: deleteReply
/**
* Delete a reply in an existing discussion
* @param replyId the item id to delete
*/
public async deleteReply(replyId: number): Promise<number> {
try {
const web = new Web(_spPageContextInfo.webAbsoluteUrl);
await web.getList(this.discussionListServerRelativeUrl).items.getById(replyId).delete();
return replyId;
} catch (error) {
Logger.write(`[SocialModule:deleteReply]: ${error}`, LogLevel.Error);
throw error;
}
}
示例7: getNavigationNodes
private getNavigationNodes(termSetId: string): void {
if (!termSetId) {
const errorMesssage = "The term set id for the site map is null. Please specify a valid term set id in the configuration list";
Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
this.errorMessage(errorMesssage);
this.wait(false);
} else {
// Ensure all SP dependencies are loaded before retrieving navigation nodes
this.taxonomyModule.init().then(() => {
// Initialize the main menu with taxonomy terms
this.taxonomyModule.getNavigationTaxonomyNodes(new SP.Guid(termSetId)).then((navigationTree: ITaxonomyNavigationNode[]) => {
// Initialize the mainMenu view model
this.initialize(navigationTree);
this.wait(false);
// Publish the data to all subscribers (contextual menu and breadcrumb)
PubSub.publish("navigationNodes", { nodes: navigationTree } );
const now: Date = new Date();
// Clear the local storage value
storage.local.delete(this.localStorageKey);
// Set the navigation tree in the local storage of the browser
storage.local.put(this.localStorageKey, this.utilityModule.stringifyTreeObject(navigationTree), new Date(now.setDate(now.getDate() + 7)));
}).catch((errorMesssage) => {
this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
this.wait(false);
this.initialize([]);
Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
});
}).catch((errorMesssage) => {
this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
this.wait(false);
this.initialize([]);
Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
});
}
}
示例8: resolve
}).select(ConfigurationItem.SelectFields.toString()).getAs(spODataEntityArray(ConfigurationItem)).then((items: ConfigurationItem[]) => {
if (items.length > 0) {
// Get item corresponding to the current language
const item: any = _.find(items, (e: ConfigurationItem) => e.IntranetContentLanguage === language);
if (item) {
resolve(item);
}
} else {
Logger.write("[UtilityModule.getConfigurationListValuesForLanguage]: There is no configuration item for the language '" + language + "'", LogLevel.Error);
}
}).catch((errorMesssage) => {
示例9: updateReply
/**
* Updates a reply
* @param replyId The reply id to update
* @param replyBody The new reply body
*/
public async updateReply(replyId: number, replyBody: string): Promise<void> {
try {
const web = new Web(_spPageContextInfo.webAbsoluteUrl);
const result = await web.getList(this.discussionListServerRelativeUrl).items.getById(replyId).select("Modified").update({
Body: replyBody,
});
return;
} catch (error) {
Logger.write(`[SocialModule:updateReply]: ${error}`, LogLevel.Error);
throw error;
}
}
示例10: deleteRepliesHierachy
/**
* Deletes a replies hierarchy recursively
* @param rootReply the parent reply id in the list
* @param deletedIds currently deleted ids
*/
public async deleteRepliesHierachy(rootReply: IDiscussionReply, deletedIds: number[]): Promise<number[]> {
if (rootReply.Children.length > 0) {
try {
// Delete children
await Promise.all(rootReply.Children.map(async (currentReply) => {
deletedIds.push(await this.deleteReply(currentReply.Id));
await this.deleteRepliesHierachy(currentReply, deletedIds);
}));
} catch (error) {
Logger.write(`[SocialModule:deleteRepliesHierachy]: ${error}`, LogLevel.Error);
throw error;
}
}
return deletedIds;
}