Monthly Archive December 2011

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”