How to update the web part properties at the runtime in SharePoint 2010?

1) SharePoint 2010 page have the SPLimitedWEbPartManager which manages the web part instances in particular page.

2) You have get the instance of the SPLimitedWebpart manager from a page and traverse all the web part.

3) Find the web part, In my case I will looking for xsltListViewWebPart.

3) You can use indexer also to find the web part.

4) Change the property value and Save the updated web part in the Web part manager instance.

5) Please don’t forget to update the SPWeb as well. Following is the code:-

Code Snippet
  1. SPWeb blogweb = properties.Feature.Parent as SPWeb;
  2.             string Page = blogweb.Url + "/default.aspx";
  3.             SPLimitedWebPartManager blogWPM = blogweb.GetLimitedWebPartManager(Page, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
  4.             SPLimitedWebPartCollection webparts = blogWPM.WebParts;
  5.             foreach (Microsoft.SharePoint.WebPartPages.WebPart webpart in webparts)
  6.             {
  7.  
  8.                 if (webpart.GetType() == typeof(Microsoft.SharePoint.WebPartPages.XsltListViewWebPart))
  9.                 {
  10.                     XsltListViewWebPart lstWebPart = webpart as XsltListViewWebPart;
  11.                     lstWebPart.XslLink = "blog.xsl";
  12.                     blogWPM.SaveChanges(webpart);
  13.                     blogweb.Update();
  14.                 }
  15.             }

Posted in Uncategorized | Tagged , | 5 Comments

How to provision a script inside a SharePoint Page?

1) Go to Visual Studio 2010 solution. Click on the Add a new Item.

2) Select the Module from the SharePoint-2010 Items.

image

3) Open the Elements.xml file. Add a Custom action.

<CustomAction Location=”ScriptLink”
                   ScriptBlock=”function  CloseCallback(dialogResult, returnValue) { SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK); }”
                   Sequence=”100″ />

4) Save and deploy

Posted in Sharepoint 2010 | Leave a comment

Join a Community of Technology Professionals

Microsoft myTechEd is a social networking and technical education resource developed for the technology professionals that attend TechEd North America, both in-person or virtually online. Year-round access to like-minded professionals provides myTechEd members with opportunities to LEARN and help advance their depth of knowledge with Microsoft technologies; CONNECT with Microsoft experts, partners, speakers, and community members; and SHARE information with peers – before, during, and after each event.

Website :- http://northamerica.msteched.com/

Posted in Uncategorized | 2 Comments

Google Webmaster

Everyone wants their own website to get a higher Google rank, but its far more complicated than it sounds — terms like site indexing, ranking and search engine optimisation are often bandied about.

Google has a free service called ‘Webmasters’ that helps you understand how Google views and ranks your website, identifies problems in accessing it, provides tips on how to improve your website’s visibility and generates free and detailed traffic and analysis reports.

Website :- http://www.google.com/webmasters/

Posted in Uncategorized | 1 Comment

How to Uninstall the WSP solution using the Powershell?

 

	Start-SPAssignment -Global
        write-host "Deleting Solution............."
        $solution = Get-SPSolution | where-object {$_.Name -eq $WSPName}

        # check to see if solution package has been installed
        if ($solution -ne $null) 
	{
            # check to see if solution package is currently deployed
            if($solution.Deployed -eq $true){
            write-host "UnInstallation Started......"
            if($WSPName -eq "solution.wsp")
            {
               Uninstall-SPSolution $WSPName -AllWebApplications -Confirm:$false
            }
            else
            {
               Uninstall-SPSolution $WSPName -Confirm:$false
            }
            
            WaitForJobToFinish
            $Host.ui.Write("`n")
            $Host.ui.Write("Solution Uninstalled Successfully....") 
            $Host.ui.Write("Now Removing  the solution.....")
            $Host.ui.Write("`n")
            Remove-SPSolution –Identity $WSPName -Confirm:$false
            $Host.ui.Write("$WSPName Solution removed(deleted) succesfully")
            $Host.ui.Write("`n")
        }
Posted in Powershell | Tagged , | 1 Comment

Configuring and monitoring performance point services

http://img.widgets.video.s-msn.com/fl/customplayer/current/customplayer.swf

Posted in Uncategorized | Leave a comment

SharePoint 2010 : How to create custom error page for SharePoint website?

Create your custom error page (error.aspx or error.htm) . I have created an htm page and place it 14 hive\Template\<Custom Folder>\error.htm.

Code Snippet
  1. <HTML><HEAD></HEAD><BODY>This is SharePoint 2010 error page.</BODY><HTML>

Open the power shell command prompt and change the page with the following steps :-

 

clip_image001

Posted in Uncategorized | Leave a comment

SharePoint 2010 : Seven pages which doesn’t user Master Pages

In SharePoint 2010, following are pages which doesn’t use the Master page but still customizable :-

1) AccessDenied.aspx

2) Confirmation.aspx

3) Error.aspx

4)  Login.aspx

5) Reqacc.aspx

6) SignOut.aspx

7) WebDeleted.aspx

Posted in Uncategorized | Leave a comment

My previous blog link

http://blogs.msdn.com/b/navdeepm/

Posted in Uncategorized | Tagged | Leave a comment

SharePoint Troubleshooting tools

following are the tools which are very helpful while working with SharePoint Technologies. It save lot of time in development, deployment  and administration of SharePoint products.

SPDisposeCheck is a tool that helps developers and administrators check custom SharePoint solutions that use the SharePoint Object Model helping measure against known Microsoft dispose best practices. This tool may not show all memory leaks in your code and may produce false positives which need further review by subject matter experts.

http://archive.msdn.microsoft.com/SPDisposeCheck

Fiddler 2 supports debugging HTTPS traffic. If you want to bend the SharePoint without bending the rules. This  tool provide a great information on SharePoint.

http://www.fiddlertool.com/fiddler/version.asp

A graphical display of relogged perfmon files.

http://sqlperfmonanalyzer.codeplex.com/


Performance Analysis of Logs (PAL) Tool

http://pal.codeplex.com/

FileMon for Windows

http://technet.microsoft.com/en-us/sysinternals/bb896642

Introducing SQL Server Profiler

http://msdn.microsoft.com/en-us/library/ms181091.aspx

.NET Reflector

http://www.red-gate.com/products/dotnet-development/reflector/

Configure WCF Trace

http://msdn.microsoft.com/en-us/library/ms733025.aspx

Configure Workflow tracing

http://wiki.windowsworkflowfoundation.eu/default.aspx/WF/TracingWorkflowFoundation.html

http://msdn.microsoft.com/en-us/library/ee518966.aspx

ULSViewer allows users to open a ULS log file and display its contents in a user friendly format. Users can then perform advanced functions such as filtering, sorting, highlighting, loading logs, appending logs, etc in order to single out the data that is important to the user. This information can be used to diagnose problems with machines running ULS services, or to monitor machines and the events they create in realtime.

http://archive.msdn.microsoft.com/ULSViewer

Windows Identity Foundation (For Claims based Authentication)

http://msdn.microsoft.com/en-us/library/ee517292.aspx

How to write in event logs?

System.Diagnostics.EventLog log = new System.Diagnostics.EventLog(“Application”, Environment.MachineName, “NMClaims”);

log.WriteEntry(currentuser, System.Diagnostics.EventLogEntryType.Information);

public override void Execute (Guid targetInstanceId) {

// If in debug mode, trigger a false assertion to give time

// to attach the debugger to the OWSTIMER.EXE process.

#if (DEBUG)

System.Diagnostics.Trace.Assert(false);

#endif

// Continue with the rest of existing Execute() method.

}

Posted in Uncategorized | 1 Comment