Tag Archives: Sharepoint 2010

Create Site Collection with its own database

Creating Database:
New-SPContentDatabase -Name -WebApplication

Create Site Collection
New-SPSite -OwnerAlias -ContentDatabase -Name -Description -Template CMSPUBLISHING#0

Email selected contacts in sharepoint 2010

 

This script adds ‘Email Selected Contacts’ to the last TR in ‘Contacts’ webpart.
Click on ‘More’ and copy paste the code in content editor

Get Content database Guid

Use SharePoint_config

SELECT id, name FROM OBJECTS
WHERE Properties LIKE ‘%Microsoft.SharePoint.Administration.SPContentDatabase%’

Hiding ECB Menu items

I have read articles about editing core.js and other complicated ways.. I found an easy way and the best part is its one line of code !

.ms-MenuUIULItem[text='Add to My Links']{display:none !important;}

Replace ‘Add to My Links’ with your choice of menu item to hide.

Here is the source and this is how I figured it out

<li class="ms-MenuUIULItem" type="option" text="Add to My Links" onmenuclick="Portal_Tasks('PinToMyPage')" iconalttext="" sequence="1000" id="mp14_0_10"><div class="ms-MenuUIULItem" type="option" text="Add to My Links" onmenuclick="Portal_Tasks('PinToMyPage')" iconalttext="" sequence="1000"><a class="ms-MenuUIULLink" id="mp14_0_10_Anchor" href="javascript:;" onclick="return false;"><span class="ms-MenuUIIcon" style="white-space: nowrap; "><img class="ms-MenuUIULImg" width="16" height="16" id="mp14_0_10_ICON" src="/_layouts/images/blank.gif" alt="" title=""></span><span class="ms-MenuUILabel" style="white-space: nowrap; " id="ID_AddToMyLinks"><span style="white-space: nowrap;">Add to My Links</span><span></span></span><span style="float: left; width: auto; white-space: nowrap; display: none; " class="ms-MenuUIAccessKey"></span><span class="ms-MenuUISubmenuArrow" style="white-space: nowrap; display: none; "></span></a></div></li>

Navigation menu delay

Here is the code to introduce custom navigation hover/unhover delay. This is a javascript file and I added this to master page.

var constShowDelay = 350;
    var constDisappearDelay = 100;
    var myVar;
    var myTimeoutID;
    var myNode, myData;
    var ref_Menu_HoverStatic;
    var ref_Menu_Unhover;
    var ref_overrideMenu_HoverStatic;

function Func_Menu_HoverStatic(item) {

       Func_overrideMenu_HoverStatic(item);
    }

    function Func_overrideMenu_HoverStatic(item) {
        var node = Menu_HoverRoot(item);
        var data = Menu_GetData(item);
        myNode = node;
        myData = data;
        if (!data) return;
        myVar = item;
        myTimeoutID = setTimeout("Func_DelayExpandMenu(myNode,myData)",
        constShowDelay); 

    }

    function Func_DelayExpandMenu(node, data) {
        __disappearAfter = constDisappearDelay;
        Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
    }

    function Func_Menu_Unhover(item) {
        clearTimeout(myTimeoutID);
        ref_Menu_Unhover(item);
    }

function _NavigationDelay(){

if ((typeof (Menu_HoverStatic) != 'undefined')) {
            ref_Menu_HoverStatic = Menu_HoverStatic;
            Menu_HoverStatic = Func_Menu_HoverStatic;
            ref_Menu_Unhover = Menu_Unhover;
            Menu_Unhover = Func_Menu_Unhover;
            ref_overrideMenu_HoverStatic = Menu_HoverStatic;
            Menu_HoverStatic = Func_overrideMenu_HoverStatic;
        }

}