Wednesday, April 17, 2013

Delete User from Site Collection

Hint:
Only site collecton administrators can make this changes.

Steps:
1. Go to top level site
2.
3. Click on "People and Group" 
4. Notice at the URL. At the end of the URL change MembershipGroupId=(whatever) to MembershipGroupId=0 
4. Click Actions 
5. Select the user and delete user from site collection

Monday, April 15, 2013

Open 2 excel files in separate windows

start - run - regedit:

Left column
HKEY_CLASSES_ROOT/Excel.Sheet.8/shell/Open/commend:
Right column {adding (space)"%1"}
Double Click on (Default) and write - "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" /e "%1"
Right Click on Command – choose "rename" and add something to the name  - for example 2 (commend2).

Left column
HKEY_CLASSES_ROOT/Excel.Sheet.8/shell/Open/ddeexec:
Right Click on the folder ddeexec and choose "rename" and add something to the name  - for example 2 (ddeexec2)

Left column
HKEY_CLASSES_ROOT/Excel.Sheet.12/shell/Open/commend:
Right column {adding (space)"%1"}
Double Click on (Default) and write - "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" /e "%1"
Right Click on Command – choose "rename" and add something to the name  - for example 2 (commend2)

Monday, February 18, 2013

Repeating Section in a List

By default, there is no option to insert repeating section in a customize form from the list.
The trick is copy and paste the control from other form that has repeating section already and it works.

Tuesday, January 22, 2013

Error- Exception from HRESULT: 0x80131904

Error- Exception from HRESULT: 0x80131904

Possible solution:
This is caused by an index on a column that no longer exists. 
There is an index on a column – that needs to be removed.

Friday, January 11, 2013

Link to New Form in InfoPath Library

Build this url:

http://{server}/_layouts/FormServer.aspx?xsnLocation=http://{fullpath to the library}/forms/template.xsn?DefaultItemOpen=1



Tuesday, January 8, 2013

Calculated Column to Show only Year

Formala:

=''" &YEAR([DateColumn])
=””& is used to remove the commas from the year

Make SharePoint Column read-only javascript

<script type="text/javascript">
function getTagFromTagNameAndTitle(tagName, title) {
  var tags = document.getElementsByTagName(tagName);
  for (var i=0; i < tags.length; i++) {
    var tempString = tags[i].id;
    if (tags[i].title == title) {
      return tags[i];
    }
  }
  return null;
}
function GetParentByTagName(parentTagName, childElementObj)
{
var parent = childElementObj.parentNode;
while(parent.tagName.toLowerCase() != parentTagName.toLowerCase())
{
parent = parent.parentNode;
}
return parent;
}
function GetFieldRow(fieldLabel)
{
var nobrs = document.getElementsByTagName("nobr");
var strValue ='';
for(var i=0; i < nobrs.length ; i++)
{
  strValue = nobrs[i].innerText;
  strValue = strValue.substring(0,strValue.length-2);
  if (strValue == fieldLabel)
  {
    var tr = GetParentByTagName("TR", nobrs[i]);
    return tr;
  }
}
}
var ctrl = getTagFromTagNameAndTitle('input','Name of the column you want to make Read Only');
ctrl .disabled  = true;
_spBodyOnLoadFunctionNames.push("StartUpCustomScript");
function StartUpCustomScript()
{
        ChangeOkButtonOnclickEvent("Input","SaveItem");
}
function ChangeOkButtonOnclickEvent(tagName, identifier)
{
    var len = identifier.length;
    /*find all Input type controls on page (ie. control with tag <Input/>)*/
    var tags = document.getElementsByTagName(tagName);
    for (var i=0; i < tags.length; i++)
     {
        var tempString = tags[i].name;     
        /*find any Input type controls on page has its name ending with 'SaveItem'*/      
        if(tempString.indexOf(identifier) == tempString.length-len )
        { 
           /*if found, replace it default onclick with our custom script*/
           var func = tags[i].attributes["onclick"].value.replace("if (!PreSaveItem())",                  
         
          "var ctrl = getTagFromTagNameAndTitle('input',' Name of the column you want to make Read Only ');"+
          "ctrl .disabled  = false;"+
                     "if (!PreSaveItem())");

           /*remove its default onclick event*/
           tags[i].onclick = null;
           /*re-register its onlick event with new script*/
           tags[i].attachEvent("onclick",new Function(func));
        }
    }
    return null;
}

</script>