Posts

How to copy DLLs from GAC.

You can copy the DLLs from GAC by following below steps. 1.Open Run and execute below command   regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll - shfusion.dll It is an explorer extension DLL that gives a distinct look to the GAC folder. Unregistering this file will remove the assembly cache viewer and the GAC folder will be then visible as any normal folder in explorer.  2. Now Open “%windir%\assembly\GAC_MSIL”. 3. Then find out your dll and copy to required location. 4.    Run "regsvr32 /i %windir%\Microsoft.NET\Framework\<.NET version directory> \shfusion.dll" to re-register the shfusion.dll file and regain the original distinct view of the GAC.

Add Nuget Package for All projects in a Solution using console.

Use below command to add Nuget package for all projects in a Visual studio solution.  Get-Project -all | ForEach-Object {Install-Package Microsoft.SharePoint.dll -Version 14.0.0 -project $_.Name}

Move site collections between databases in Sharepoint 2010

Open Sharepoint Management Shell in Administrator mode and run following command. Move-SPSite <http://site/sites/sitename> -DestinationDatabase <Destination Content DB Name> Then Reset IIS

Validation for Asp FileUpload Control using JavaScript

function validatefileuploadcontrol() { $( $( 'input[id*="FileUpload1"]' )).change( function () { var fileExtension = [ 'doc' , 'docx' ]; //Extensions if ($.inArray($( this ).val().split( '.' ).pop().toLowerCase(), fileExtension) == - 1 ) { alert( "'.doc', '.docx' formats are allowed." ); } }) }

SharePoint 2010: JavaScript Code To Check if user exists in a group (ECMA)

//Call this function where you want IsCurrentUserMemberOfGroup( "GropuName" , function (isCurrentUserInGroup) { if (!isCurrentUserInGroup) { } }); //Below is the Function to Check whether the user exists in the group or not function IsCurrentUserMemberOfGroup(strGroupName, functionComplete) { //Setup Vars currentContext = null ; currentWeb = null ; allGroups = null ; leaderGroup = null ; currentUser = null ; groupUsers = null ; //Get an instance of the Client Content. currentContext = new SP.ClientContext.get_current(); //Grab the client web object. currentWeb = currentContext.get_web(); //Get the current user object currentUser = currentContext.get_web().get_currentUser(); currentContext.load(currentUse...

Delete Sharepoint List Using PowerShell

$web = get-spweb -Identity http://sp2010 $list = $web.lists["corrupted list name"] $list.AllowDeletion = $true $list.Update() $list.Delete()

javascript to get the all site user in sharepoint 2010 (Getting all Site users using Client Object Model)

 If you want to get the all sharepoint site users and their groups you need to do following steps Step1: open notepad and paste below script in that and save that file with the extension of ".js" ExecuteOrDelayUntilScriptLoaded(retrieveAllUsersAllGroups, "sp.js" ); function retrieveAllUsersAllGroups() { var clientContext = new SP.ClientContext.get_current(); this .collGroup = clientContext.get_web().get_siteGroups(); clientContext.load(collGroup); clientContext.load(collGroup, 'Include(Users)' ); clientContext.executeQueryAsync( Function .createDelegate( this , this .onQuerySucceeded), Function .createDelegate( this , this .onQueryFailed)); } function onQuerySucceeded() { var userInfo = '<tr>' ; var grouname = '<tr>' ; var text = "<table><tr><th>GroupName</th><th>GroupMembers</th></tr>" ; var groupEnumerator = collGroup.getEnumerator(...