在SIte操作页面上添加自定义菜单 [英] Add custom menu on SIte action page

查看:55
本文介绍了在SIte操作页面上添加自定义菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


我正在尝试实施此处描述的解决方案  https://github.com/SharePoint/PnP/tree/master/Samples/Core.SiteClassification  ;我已经下载了所有必要的文件,但我不确定我是如何实现这一点的,任何人都可以帮助我在这里创建自定义网站操作 



谢谢


Kundan


 


解决方案


如果您不熟悉控制台应用程序/ SharePoint加载项,则可以使用JSOM向SharePoint添加自定义操作。


< script language =" javascript"类型= QUOT;文本/ JavaScript的" SRC =" // ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> 
< script language =" javascript" type =" text / javascript">


(document).ready(function(){
SP.SOD.executeFunc('sp.js','SP。 ClientContext',AddCustomUserAction);
});

函数AddCustomUserAction(){
//获取客户端上下文和web对象
var clientContext = new SP.ClientContext();
var oWeb = clientContext.get_web();
//获取自定义用户操作集合并向其添加新的自定义操作
var collUserCustomAction = oWeb.get_userCustomActions();
var oUserCustomAction = collUserCustomAction.add();
//指定新自定义操作的位置和属性
oUserCustomAction.set_location('Microsoft.SharePoint.StandardMenu');
oUserCustomAction.set_sequence(101);
oUserCustomAction.set_group('SiteActions');
oUserCustomAction.set_title(" Search Settings");
oUserCustomAction.set_url(" /sites/Playground/_layouts/15/enhancedSearch.aspx?level = sitecol");
oUserCustomAction.update();
//加载客户端上下文并执行批处理
clientContext.load(collUserCustomAction);
clientContext.executeQueryAsync(QuerySuccess,QueryFailure);
}

函数QuerySuccess(){
console.log("新的自定义用户操作已添加到网站设置");
}

函数QueryFailure(){
console.log(args.get_message());
}
< / script>

以下是供您参考的帖子。


https://www.c-sharpcorner.com/article/create-sharepoint-custom-user-action-in-site-actions-menu- using -javascript-objec /


最好的问候,



Hello All,

I am trying to implement solution described here https://github.com/SharePoint/PnP/tree/master/Samples/Core.SiteClassification  I have downloaded all the necessary file but I am not sure how i can achive this , Can anyone help me out here out to create custom site action 

Thanks

Kundan

 

解决方案

Hi,

If you’re not familiar with console app/SharePoint add-in, you could use JSOM to add custom action to SharePoint.

<script language="javascript" type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script language="javascript" type="text/javascript">


(document).ready(function() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', AddCustomUserAction); }); function AddCustomUserAction() { //Get the client context and web object var clientContext = new SP.ClientContext(); var oWeb = clientContext.get_web(); //Get the custom user action collection and add the new custom action to it var collUserCustomAction = oWeb.get_userCustomActions(); var oUserCustomAction = collUserCustomAction.add(); //Specify the location and properties for the new custom action oUserCustomAction.set_location('Microsoft.SharePoint.StandardMenu'); oUserCustomAction.set_sequence(101); oUserCustomAction.set_group('SiteActions'); oUserCustomAction.set_title("Search Settings"); oUserCustomAction.set_url("/sites/Playground/_layouts/15/enhancedSearch.aspx?level=sitecol"); oUserCustomAction.update(); //Load the client context and execute the batch clientContext.load(collUserCustomAction); clientContext.executeQueryAsync(QuerySuccess, QueryFailure); } function QuerySuccess() { console.log("New Custom User Action has been added to site settings"); } function QueryFailure() { console.log(args.get_message()); } </script>

Here is the thread for your reference.

https://www.c-sharpcorner.com/article/create-sharepoint-custom-user-action-in-site-actions-menu-using-javascript-objec/

Best Regards,

Lee


这篇关于在SIte操作页面上添加自定义菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆