Code :
SPRibbon ribbon = SPRibbon.GetCurrent(this);
ribbon.TrimById("Ribbon.ListItem.New.NewFolder");
Step 1 : Create web part/VisualWebpart in VS2010
add above code
Step 2: go to Library/List >> Site Actions >> Edit Page >> Add Web Part >> Stop Editing
see the magic..... its awesome....
Note: "Ribbon.ListItem.New.NewFolder" is the ButtonId which i want to hide from list Ribbon.
To Find more ButtonId go to
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\xml\CMDUI.XML
Thursday, November 24, 2011
Hide Ribbon Button
Friday, October 28, 2011
Web Service to Add Items in List
Step -1 : Add Web Reference "http://[WebSiteName from sharepoint server IIS]/_vti_bin/lists.asmx" into your application by name "SharepointListWebService"
Step -2 : Add code
SharepointListWebService.Lists AddAlerts = new SharepointListWebService.Lists();
AddAlerts.Credentials = System.Net.CredentialCache.DefaultCredentials;
//AddAlerts.Credentials = new System.Net.NetworkCredential("UserName", "passsword");
//AddAlerts.Url = "http://[WebSiteName from IIS]/_vti_bin/lists.asmx";
XmlNode node = AddAlerts.GetListAndView("ListName", "");
string sListID = node.ChildNodes[0].Attributes["Name"].Value;
string sViewID = node.ChildNodes[1].Attributes["Name"].Value;
XmlDocument doc = new XmlDocument();
XmlElement batch = doc.CreateElement("Batch");
batch.SetAttribute("OnError", "Continue");
batch.SetAttribute("ListVersion", "1");
batch.SetAttribute("ViewName", sViewID);
string item = "<Method ID=\"1\" Cmd=\"New\">" +
"<Field Name=\"ID\">New</Field>" +
"<Field Name=\"Title\">This is a test from other application</Field>" +
"</Method>";
// batch.InnerXml = "< Method ID='1' Cmd='New'>" +
//"<Field Name='ID'>New</Field>" +
//"<Field Name='Title'>Time</Field>" +
//"</Method>";
batch.InnerXml = item;
AddAlerts.UpdateListItems(sListID, batch);
Step -3 :Enjoy....
Monday, October 24, 2011
Script to Hide Item Action Menu on Allitem.aspx
//Script to Change/Hide the Item action
//Add it just before </asp:Content>
<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("resetAddSendSubMenu()");
function resetAddSendSubMenu(){
//Sent to
AddSendSubMenu = function (m,ctx) {};
//Check In
AddCheckinCheckoutMenuItem = function(m, ctx, currentItemEscapedFileUrl){};
//AddManagePermsMenuItem = function (m, ctx, ctx.listName, currentItemID){};
//Manage Permission
AddManagePermsMenuItem = function(m, ctx, listId, url) {} ;
//View/Edit
AddDocLibMenuItems = function (m,ctx){};
//var AddDocument = document.getElementById("idHomePageNewDocument");
//AddDocument.style.display = "none";
var ttnA = document.getElementsByTagName('A');
for (var j=0; j<ttnA.length; j++)
{
//alert(ttnA[j].id)
if (ttnA[j].id == 'idHomePageNewDocument')
{
//alert(j);
ttnA[j].style.display="none";//innerHTML='your new text goes here';
ttnA[j].previousSibling.previousSibling.style.display='none';
}
}
}
</script>
Wednesday, September 28, 2011
Powershell Commands Part-2
Today i am going to update the next step of installation..... (its Uninsatllation ..... ha ha haaaa).
Steps arise when some modification on custom code on Dev. Environment and want to update production environment.
Step :1
//Unistall
stsadm -o deactivatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
//if activated
stsadm -o deactivatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
stsadm -o uninstallfeature -filename Feature Folder Name\feature.xml
stsadm -o retractsolution -name ******.wsp -local
//Optional
stsadm -o retractsolution -name ******.wsp -immediate -allcontenturls
stsadm -o deletesolution -name ******.wsp -override
Note : find your Featue Folder Name from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\
Step :2
Follow the same sequence of Installation commands which mention on Part-1
Steps arise when some modification on custom code on Dev. Environment and want to update production environment.
Step :1
//Unistall
stsadm -o deactivatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
//if activated
stsadm -o deactivatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
stsadm -o uninstallfeature -filename Feature Folder Name\feature.xml
stsadm -o retractsolution -name ******.wsp -local
//Optional
stsadm -o retractsolution -name ******.wsp -immediate -allcontenturls
stsadm -o deletesolution -name ******.wsp -override
Note : find your Featue Folder Name from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\
Step :2
Follow the same sequence of Installation commands which mention on Part-1
Monday, September 26, 2011
Powershell Commands Part-1
As currently working on Sharepoint 2010. I am very excited to share those things which i learn from my mistakes....
Many people ask me, how will you add/deploy your custom code on sharepoint production site? it was really tough to answer...
so, i am posting the powershell commands. hope, it will help you.
//Install
stsadm -o addsolution -filename "Path\*****.wsp"
Install-spsolution –identity *****.wsp –gacdeployment
//After this command dll placed into GAC and Feature.xml created into 14 halve\Templates\FEATURES Folder
//Always
stsadm -o uninstallfeature -filename Feature Folder Name\feature.xml
stsadm -o installfeature -filename Feature Folder Name\feature.xml
stsadm -o activatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
Note : find your Featue Folder Name from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\
Many people ask me, how will you add/deploy your custom code on sharepoint production site? it was really tough to answer...
so, i am posting the powershell commands. hope, it will help you.
//Install
stsadm -o addsolution -filename "Path\*****.wsp"
Install-spsolution –identity *****.wsp –gacdeployment
//After this command dll placed into GAC and Feature.xml created into 14 halve\Templates\FEATURES Folder
//Always
stsadm -o uninstallfeature -filename Feature Folder Name\feature.xml
stsadm -o installfeature -filename Feature Folder Name\feature.xml
stsadm -o activatefeature -filename Feature Folder Name\feature.xml -url http://domainname:port -force
Note : find your Featue Folder Name from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\
Welcome to my Blogger
Its is a great priviledge to share my knowledge with you and to learn many things from all of you....
Kindly add your helpful post/Comment....
Thanking you.
Kindly add your helpful post/Comment....
Thanking you.
Subscribe to:
Comments (Atom)