Archive

Archive for the ‘MOSS 2007’ Category

Group Permissions,How Does it Work?

September 18th, 2008 1 comment

Browse to the People and groups page in site settings and click on one of the existing groups. From Settings menu, choose View Group permissions:

grouppermission1.png
ViewGroupPermissions.aspx page located in _layouts folder is loaded as shown below. The ViewGroupPermissions page is one of few pages which is still stuck in version 2.0 look&feel 🙂

grouppermission21.png


When the above page is loaded, a parameter named ID is passed in (via query string) which is equal to the Group ID of group you just chose.ViewGroupPermissions.aspx page uses a GroupPermissions control and sets its GroupId property to the ID parameter that it receives from the query string.

I have explained in the community content of this page how GroupPermissions control works, but once again I’d like to draw your attention to the last paragraph of what I wrote in the description section:

One thing needs to be highlighted here about the URL column (effective scope) : in addition to the listed URLs, specified group has access to any sites, lists, or items that inherit permissions from these URLs. This means that those URLs won’t be listed by the control, but if you break the inheritance on a securable object and explicitly give the group some kind of permissions, that securable object will be listed in the control. For example, if a list item has fine grained permission set for a given group, meaning that it doesn’t inherit permissions from its parent object (list), the URL to that list item will be shown by GroupPermissions control.

here is the screenshot of the code included. In the Web part below, I am demonstrating how you can use  GroupPermissions control programmatically. Please pay attention to the last item. A document called CKS Documentation.docx which has explicit permissions set for the current site’s associated visitors group. I broke the inheritance on this list item.


grouppermission3.png

Categories: MOSS 2007 Tags:

Disabling XML DataSources

September 17th, 2008 No comments

In WSS object model, there is a family of XML-based data source controls which enable declarative or programmatic databinding models against a variety of underlying XML data stores. In this family, the abstract BaseXmlDataSource control serves as the base class .It extends HierarchicalDataSourceControl class and implements IDataSource interface to support both hierarchical and tabular data for all derived types. There are three main XML-based data sources that extend BaseXmlDataSource control  :

  1. SPXmlDataSource
  2. XmlUrlDataSource
  3. SoapDataSource

*Read the community content in each class for more information.

For example, if you place a RSS Viewer Web Part on a page and sets its RSS Feed URL property , open the page in SharePoint Designer and you would see that XmlUrlDataSource is used as the main data source serving the Web part.rezarssnormal.png

Browse to Central Administration Web site , Operations tab and choose Data Retrieval Service link in the Data Configuration section. As you can see  on the bottom of this page, there is a checkbox by which you can enable/disable XmlUrlDataSource, SPXmlDataSource, SoapDataSource or AggregateDataSource data source controls per Web application or globally across the entire farm.  Once “Enable these data source controls” check box is cleared , no query requests will be processed by these data source controls. This is a great controling and performace check feature in the hands of administrators to control databinding operations in a SharePoint Web application.

spdisableds.png

Clear the checkbox and do an iisreset. Then referesh the page containing the RSS Viewer web part and as expected , you will get the following error message.

rezarsserror.png

Check the ULS log and here is the execption thrown by the RSS Viewer Web Part. One of a few pleasant error messages , eh? 😉

RssWebPart: Exception handed to HandleRuntimeException.HandleException Microsoft.SharePoint.WebPartPages.DataSourceControlDisabledException: The server administrator has disabled the Data Source control required to execute this query. Contact the server administrator for more information.

Categories: MOSS 2007 Tags:

IDesignTimeHtmlProvider Interface

September 16th, 2008 No comments

You can implement this interface to have a different HTML rendition for your Web parts and controls in SharePoint Designer than what you see in the browser. Well, if that’s what you are looking for, IDesignTimeHtmlProvider interface is definitely your friend!

As you can see in the pictures below , my simple Web part renders two different type of messages at run-time and design-time. For more information see my notes in the community content of this page.

Browser:
idesignviewbrwoser.jpg

SharePoint Desginer:
idesignviewspd.jpg

Categories: MOSS 2007 Tags:

LinkSection

September 15th, 2008 No comments

SharePoint is full of UI buidling bloks that can be reused , either declaretively or programmatically, to build your UI components. In this blog post, I demonstrated how you can leverage LinksTable user control to create a cool-looking link box that mataches out of the box links (Look at Site settings page). There is another user control called LinkSection  (inhertirs Microsoft.SharePoint.WebControls.LinkSection) which gives you more control over other parts of your link box such as Title and Description.

Read my notes on the community content of this page.

linksection.png

Categories: MOSS 2007 Tags:

Web part with Toolbar (Part 2)

September 13th, 2008 No comments

Sometime in January this year , I wrote a blog post here in which I introduced one possible way of adding a Toolbar to a Web part. Although , I am not a big fan on loading user controls dynamically into my Web parts , in order to achieve what I wanted to do , I kind of had to leverage the OOTB toolbar.ascx user control; therefore dynamically load it into the parent control (my Web part).

While the technique in my previous post would work in most of the cases, dynamically loading the control by using LoadControl() method, periodically kept failing on us  in the following scenarios:

a)  In controls deployed to the bin folder and therefore running in partially trusted environments

b) Forms Based Authentication protected sites

And

c) Casting to the base type (ToolBar) in order to call the overloaded functionality.

I was never able to reproduce the issue , but couple fails was convincing enough for me to look for a better technique to add the toolbar chrome to my Web parts. Well, today while I was documenting RepeatedControls class, I found another way to achieve this. Read my notes in the community content of this page.

wpwithtoolbar.png

Source Code is available here: wpwtoolbar2.rar

More details can be found here.

For this technique used in a much bigger scenario click here.

Update 11/28/2010: Bil Simser further expands this example in his blog using TABLE tags instead of DIVs I initially used. His solution looks more real life and is really cool! Make sure you check his blog post here.

Categories: MOSS 2007 Tags: