Recent Blogs

AvatarByRashid Aziz

SharePoint 2010 WSRP Viewer WebPart Configuration

In SharePoint only a user can connect a WSRP viewer web part to a trusted producer. Any producer that has been configured for use in the farm by the SharePoint administrator is known as trusted producer. End users are restricted to add trusted producers and cannot override the settings so that end users and sharepoint environment can be protected from malicious remote portlet.

How to add a trusted:

SharePoint administrator have to create a TrustedWSRPProducers.config file in the “C:\program files\Microsoft Office Server\14.0\Config” folder on the SharePoint web front ends.  

TrustedWSRPProducers.config  sample file: 

<Configuration >
<Producer Name="NetUnity" AllowScripts="true">
<ServiceDescriptionURL>http://wsrp.netunitysoftware.com:80/WSRPTestService/WSRPTestService.asmx</ServiceDescriptionURL>
<RegistrationURL>http://wsrp.netunitysoftware.com:80/WSRPTestService/WSRPTestService.asmx</RegistrationURL>
<MarkupURL>http://wsrp.netunitysoftware.com:80/WSRPTestService/WSRPTestService.asmx</MarkupURL>  
<PortletManagementURL>http://wsrp.netunitysoftware.com:80/WSRPTestService/WSRPTestService.asmx</PortletManagementURL>
</Producer>
</Configuration>

 Now place the file “C:\program files\Microsoft Office Server\14.0\Config” folder on the SharePoint web front ends a user can configure the WSRP Viewer web part.

After adding WSRP viewer web part to a site the designer or administrator have to open up the web parts configuration panel to modify a few settings.

Producer Modification:  

A drop down lists out available producers TrustedWSRPProducers.config file.   After the producer is selected the portlet drop down selector will populate with the available values for the selected producer. Select the desired portlet, click the OK button to save these settings. 

                      

For additional configuration SharePoint site must be switched to edit mode and then the Edit Web Part option needs to be selected from the WSRP viewer web part drop down menu.

Edit mode display the web parts configuration tool pane along with displaying additional portlet configuration information in the location of the web part on the SharePoint site.

The webpart will display the news feed from yahoo as shown below.

WSRP is one of many portals when working with SharePoint 2010. SharePoint’s business connectivity services and creating custom data view webParts from web services  using SharePoint Designer.  

AvatarByRashid Aziz

Get SharePoint 2010 Publishing Site Page Layout Programmatically

I have come across a business requirement, while implementing this I need to get publishing site page layout on sharepoint 2010 using server object model.

After a little research I managed to do this, I think it is worth to share code with you guys.

The code below was used to get the default page layout of a publishing web site in SharePoint 2010.

private static void GetPageLayout()
{
using (SPSite site = new SPSite("Publishing Site Collection URL"))
{
using (SPWeb web = site.OpenWeb())
{
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);

PageLayout pageLayout = publishingWeb.DefaultPageLayout;
Console.WriteLine("Layout Name: "+pageLayout.Name + " Site URL: " + pageLayout.ServerRelativeUrl);
}
}
}

 

AvatarByRashid Aziz

SharePoint 2010 List Throttling Feature Explained

The List Throttling is a brand new concept in sharepoint 2010.  The concept of this functionality is to set the limit on the row of data can be retrieved from a SharePoint List at on time. This concept is same for Sharepoint document library for retrieving data.

Use Case: The list throttling setting will be applied on list views created by users and queries executed by custom code. When someone runs the query to retrieve all items, the number of items returns will be determined by the throttling setting for the given list and the user rights.

Throttling Settings: You can set the throttling settings via central admin.

In order to go to these settings, follow this path, Central Administration > Application Management  >  Manage Web Application. Once in the Web Application List, select the web application and click General Settings > Resource throttling.

AvatarByRashid Aziz

How to get list of all site owners in SharePoint web application

We are implementing governance in place for our SharePoint environment, during the analysis  we need to find out who is the site owner for each site in our SharePoint web applications,  we have about 500 sites and it will be  time consuming to go to each one site settings and find the owners names. I wrote a simple stsadm command to get list of site owners and some other site related information and dump it into a text file.

Open the command prompt and navigate to the following path C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

Run the following command.

stsadm -o enumsites -url http://WebApplicationURL > c:\allsiteinfo.txt

once the command runs successfully , go to c drive and open “allsiteinfo.txt” file. You will see result something like this.

<Sites Count="2">
<Site Url="http://testweb/site1" Owner="eblogin\admin" ContentDatabase="MOSS2007DB" StorageUsedMB="36.8" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url=" http://testweb/site2" Owner="eblogin\admin" SecondaryOwner="eblogin\aziz" ContentDatabase=" MOSS2007DB" StorageUsedMB="0.7" StorageWarningMB="0" StorageMaxMB="0" />
</Sites>

 If you like my blog please follow me on facebook and twitter to get latest blog alerts.

AvatarByRashid Aziz

How to display list data in SharePoint 2010 chart web part

In this exercise I will show you how to use the Chart Web Part to provide a simple way to provide charts on a Web Part page so that users can visualize data in native lists within a SharePoint site as well as external lists created with the BCS, I have create a simple list for chart data, but keep in mind that you can use data from backend systems like using BCS external content types.

I have created a list called “Sales list” which has two main columns, “Country” and “Revenue” with some data in it, as shown in below image.

The Chart Web Part is part of the Enterprise Edition of SharePoint Server 2010. Therefore, you must activate an enterprise feature on your site collection before using chart web part.

Activate Enterprise Features

Go to Site Actions > Site Settings

Select “Site collection features” under “Site collection Administration” section

Activate feature called “SharePoint Server Enterprise Site Collection features”

Navigate back to the Site setting page

Select “Manage site features” under “Site action” section

Activate the feature called “SharePoint Server Enterprise Site features”. Activation of these features makes the Chart Web Part available to use.

Adding and configuring Chart Web Part

Go to site home page or where you want to add web part.

Select “site action” > edit page

Click on “Add a web part”

Select the “Chart Web Part” from the “Business Data” folder and click the Add button place I ton the page.

Once the Chart Web Part has been added to the page, you should see a link with the caption of Data & Appearance. Click on the link which will launch a wizard and will allow you to select a data source.

On the first page of the wizard, click the link “Connect chart to data”.

Now select a data source. Choose “Connect to a List” and click “Next”.

On the next page it ask you to choose a source list, in my case it will “Sales list”

Next page will show you the data from list just click “Next”

In the final wizard Page it will ask to bind your chart with the select,

You need to select X and Y filed from the list, In my case

Y Field:  Revenue

X Field: Country

After you bind list column with chart click “Finish”

You will see the basic chart as shown below.

 

 

Note: If you want to change chart type (e.g. pie chart, lines chart), on the first page of the wizard click “Customize Your Chart” and select your shape and click “Finish”. J

I have customized chart type to pie later as shown below. 

 

 

AvatarByRashid Aziz

How to configure PerformancePoint service in sharepoint 2010

Today I will show you how to configure PerformancePoint service in SharePoint 2010. The PerformancePoint service is integrated in sharepoint 2010 environment. The PerformancePoint service is sharepoint 2010 enterprise feature, as long as you have enterprise feature switched on the PerformancePoint service will be available.

Installing PerformancePoint Service Application

Make sure that you have enterprise version of SharePoint 2010 installed.

Open sharepoint 2010 central admin site

Click on Manage Service Applications under Application Management

Click on new from top ribbon and select “PerformancePoint Service application”

Provide the service app name, SQL database configuration, application pool and select security account for App Pool.

Click ok, you will see the following if “PerformancePoint Service application” installed successfully.

Starting the PerformancePoint service

Open the SharePoint 2010 central administration go to > System Settings > Manage services on server (under Servers category)

Click the start link to start “PerformancePoint Service”; you will get the following when it is started.


Setting up a secure store account

You cannot access the performance points unattended service account to connect to data sources without secure store account.

Open sharepoint 2010 central admin site

Click on Manage Service Applications under Application Management

Click on the Secure Store Proxy and click Manage from the top ribbon

You will get a message saying ‘Generate a new key’, Click Edit on the ribbon then say Generate a new key

Setting up unattended service account

Open sharepoint 2010 central admin site

Click on Manage Service Applications under Application Management

Click on “PerformancePoint service application” link

From setting page click on the first link “PerformancePoint Service Application Settings”

In the “Unattended Service Account” section, enter the username and password for querying the data sources

Activate PerformancePoint Site Collection feature

Open your Business Intelligence site and navigate to Site Actions > site settings > Site Collection Features (option under “Site Collection Administration” tab) and active the “PerformancePoint Site Collection features” and shown below. 


 

You have done all configurations, for testing the configuration Open a Performance Point “Business Intelligence Centre” site and click on “Run Dashboard Designer” button.

If you have effectively created a PerformancePoint site collection, you should be able to do the followings

Able to browse to the BI Centre

Can launch Dashboard Designer

Should be able to connect to a data source using the unattended service account

AvatarByRashid Aziz

Customize the sharepoint 2010 site top menu

How to hide SharePoint 2010 root node from menu, how to change TopNavigationDataSource setting on master page.

To do this you need to do some changes in your site master page.

Open you site master page in SharePoint designer

Need to delete delegate wrapper code altogether from master page and set the values of your desired properties. Locate and delete the followings from site master page. 

<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource"
  Id="topNavigationDelegate">
                    <Template_Controls>
                    </Template_Controls>
</SharePoint:DelegateControl>

You need to leave the actual data source control definition with any properties you want, as shown below:

<asp:SiteMapDataSource

  ShowStartingNode="False"
  SiteMapProvider="CombinedNavSiteMapProvider"
  id="topSiteMap"
  runat="server"/>

All of your navigation property choices will be picked up by whatever navigation control you’re using, including out-of-the-box SharePoint:AspMenu control.

You don’t see the Home link, only see the team site link.

AvatarByRashid Aziz

Add all authenticated users to sharepoint security group programmatically

One of the projects I came across a scenario where I need to pre populate custom security groups with “All authenticated Users”. I have wrote a code and run it as a part of the feature receiver.

If you have a security group with read access to a site collection, you can add “All authenticated users” into this groups and every user will have read access to that site.

In the feature receiver class FeatureActivated event I have used the following code.

SPWeb myWeb = properties.Parent as SPWeb;
permissionLevel = "Read";
myWeb.SiteGroups.Add("Site Read Group", owner, owner, "My New Category");
SPRoleAssignment roleAssignment = new SPRoleAssignment(myWeb.SiteGroups["Site Read Group"]);
roleAssignment.RoleDefinitionBindings.Add(myWeb.RoleDefinitions[permissionLevel]);
myWeb.RoleAssignments.Add(roleAssignment);
myWeb.Update();
myWeb.SiteGroups["Site Read Group "].AddUser("c:0(.s|true", string.Empty,
string.Empty, string.Empty);

Note: The “c:0(.s|true” means “All Authenticated Users”

AvatarByRashid Aziz

SharePoint 2010 chart using external data (BCS)

I want to share sharepoint 2010 OOTB feature which impressed me a lot. You can create chart in SharePoint 2010 based on external data without any custom code or using enterprise features like excel services.

So what you waiting for, follow these simple steps to get visual representation of your data in minutes.

Open the sharepoint 2010 site and go to the page where you want to add web part.

Open this page in the edit mode so you can add web part.

Now pick “Business Data” category and select “Chart Web Part” web part and add it to page. Save the page.

Go to web part properties window and chose “Connect to Data”.

From the connection source list pick “Connect to Business Data”. (If you already created a list form external content type then you can pick list form the available sharepoint lists.)

Now pick the external content type you have created earlier.

Next you will bind user interface chart to data.  You can also define more filter options

Click finish, and your web part will display the chart based on data you have selected.

AvatarByRashid Aziz

How to block sandbox solution on SharePoint 2010 farm

In sharepoint 2010 we can upload and activate sandbox solutions. Although the sandbox solutions can slow down the page system pages execution of cause an error on page. The administrator has the ability to block the sandbox solution for a particular SharePoint 2010 farm. Once the solution is blocked it can’t be activated by any user and prompt will an error message.

For testing I create a sandbox solution and called it “sandbox 1.wsp”.

Now go to the PowerShell command line and type the following commands.

$UserCodeSvc = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local
$Signature = [Microsoft.SharePoint.Administration.SPUserCodeService]::
GetSolutionSignatureFromFile($SolutionName)
$BlockedSolution = New-Object Microsoft.SharePoint.UserCode.SPBlockedSolution
-ArgumentList ($SolutionName), ($Signature), ("Solution Blocked")
$UserCodeSvc.BlockedSolutions.Add($BlockedSolution)
$UserCodeSvc.Update()

Now go to the central admin> System settings> manage user solutions, you will see that “sandbox1.wsp” is in the blocked solution list.