Archive

Archive for the ‘SharePoint’ Category

Example of how to get the URL to SharePoint 2007 Form Pages

February 11th, 2010 Dominick Cosgrove No comments

You can use the following syntax to get the fully qualified URL to a Form for a SharePoint List / Library.

SPList list = SPContext.Current.List;

SPListItem item = list[0];

item.Web.Url + "/" + item.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID

 

PAGETYPE is an enumeration of the SharePoint Forms:

PAGE_DEFAULTVIEW

Default view. Value=0.

PAGE_DIALOGVIEW

File dialog box view. Value=2.

PAGE_DISPLAYFORM

Display form for list items. Value=4.

PAGE_DISPLAYFORMDIALOG

Display form for a file dialog box. Value=5.

PAGE_EDITFORM

Edit form for list items. Value=6.

PAGE_EDITFORMDIALOG

Edit form for a file dialog box. Value=7.

PAGE_INVALID

Not used. Value= -1.

PAGE_MAXITEMS

Not used. Value=11.

PAGE_NEWFORM

New form for list items. Value=8

PAGE_NEWFORMDIALOG

New form for a file dialog box. Value=9.

PAGE_NORMALVIEW

Normal view. Value=1.

PAGE_SOLUTIONFORM

Solution form. Value=10.

PAGE_VIEW

View, including both default view and normal view. Value=3.

Custom Counter Sets in Visual Studio for Software Testers

February 9th, 2010 Dominick Cosgrove No comments

Visual Studio 2005 for Software Testers (VSST) allows you to create custom Counter Sets, which are a set of performance counters that can be applied to a computer in the test farm. VSST comes with some Counter Sets out-of-the-box (OOTB) for the Load Test, Controller and Agent amongst others:
clip_image002
Invariably when creating performance tests, you’ll develop them on a computer, which is not in the SharePoint Server Farm. This computer will most probably not have a number of the performance counters that you want to monitor. For instance SharePoint uses the w3wp (IIS) worker process, which unless you have IIS installed on your local machine, you will not be able to add the counters. To add the counters you need to specify a computer that has the counters that you require.

Typically I create a counter set for each of the server roles in the farm. This allows me to monitor different counters for different roles. For instance the Web Front End (WFE) servers counters are very different to the Back End SQL server. Joel Oleson has publish a good list of counters that the SharePoint Performance Team use.

Creating Custom Counter Set
1. Open or create a new Load Test in VSST;
2. Right mouse click on the Counter Set node and select Add Custom Counter Set;
clip_image004
3. In the properties pane give the newly created Counter Set a useful name e.g. SharePoint WFE, SharePoint DB, SharePoint Search e.t.c
4. Right mouse click the newly created Counter Set and select Add Counters;
clip_image006
5. Enter the name of the computer that you are going to collect the counters from e.g. SharePoint WFE or SQL Database server. The List of Performance Categories will be refreshed for the categories available on that server. If you select Process for instance, the list of instances will be different for the WFE and the DB servers. Select the required counters.
clip_image008
Note:
If you work in an environment where least privileges are employed you may not have sufficient right to add performance counters from a remote computer. You may encounter a message such as “Cant read performance counter categories for computer xxx”.
clip_image010
To be able to access the performance counters you need your system administrators to add you (or the account you are running the test under) to the following server roles:

  • Performance Log Users – Members of this group have remote access to schedule logging of performance counters on this computer
  • Performance Monitor Users – Members of this group have remote access to monitor this computer

Using Custom Counter Set
1. Open the Load Test where you created your custom counter set;
2. Right mouse click on Counter Set Mappings and Select Manage Counter Sets…;
clip_image012
3. In the Manage Counter Sets dialog box select Add Computer. Select the newly created Custom Counter Set and click OK;
clip_image014

References:

Global SharePoint User Group (GSPUG)

November 26th, 2009 Dominick Cosgrove No comments

The Global SharePoint User Group is having it’s first meeting on the 1st December 2009 @ 7pm ET. This will be the first virtualised SharePoint User Group, and will be presented via LiveMeeting.

If you can’t actually attend the user group meeting then they will be recorded so that you can watch them at your leisure.

They also have a survey to establish what topics / subject areas people want discussed. Make sure you take the time to complete this as this will be key to getting the right content out there.

http://www.gspug.org/

Categories: SharePoint Tags:

MS Loopback adapter

November 21st, 2009 Dominick Cosgrove No comments

If you need to browse your SharePoint site or for that matter any site, hosted on your VPC while you are not connected to a network, read on. If you are not connected to a network the VPC does not get an IP address issued hence why you cannot browse hosted sites. The solution to this is the MS Loopback Adapter. The following shows you how to set up your loopback adapter.

Add Loopback adapter

  1. Click Start, and then click Control Panel. Then click Add Hardware:
    image
  2. Select Yes, I have already connected the hardware:
    image
  3. From the list of devices select Add a new hardware device:
    image
  4. Select Install the hardware that I manually select from list (Advanced):
    image
  5. From the list of hardware types select Network Adapter:
    image
  6. From the list of Manufactures select Microsoft and from the list of Network Adapters select Microsoft Loopback Adapter:
    image
  7. Click Finish once the adapter is installed.
  8. The Loopback Adapter will now appear in you list of Network Connections:
    image

Configure Loopback Adapter

  1. In the Network Connections right mouse click on the newly created Loopback Adapter and select Properties;
  2. From the Properties select Internet Protocol (TCP/IP) and click Properties:
    image
  3. In the Properties add the IP address as follows:
    image 
  4. Click OK to commit the changes.

Configure VPC Network Adapter

  1. On Virtual PC (VPC) Console click Settings;
    image
  2. On the settings dialog box select Networking and then select Microsoft Loopback Adapter as the 1st Adapter. Click OK;
    image
  3. On the VPC click the Network icon in the task bar or navigate to the Network Connections through the control panel. The network icon may display a warning message “Limited or no connectivity”. Don’t worry about this at the moment;
    image
  4. On the Network Connections window, right mouse click on the Local Area Connection and click Properties;
    image
  5. On the TCP/IP settings for the Network adapter enter the following details. Click OK;image
  6. You will notice that the network icon on the desktop task bar no-longer displays the warning message;
  7. On the VPC, launch the Command Prompt and type IPConfig you should see that the VPC now has the IP address, subnet and gateway that you just entered;
    image
  8. From the VPC Command prompt ping 192.168.5.10 to confirm connectivity to the host;
    image 
  9. Ensure that you don’t have any network connectivity on your host computer, then from the Command Prompt ping the VPC 192.168.5.11 to confirm connectivity to the VPC;

Configure Host File

If your SharePoint (or website) uses Host Headers then you’ll need to edit your Host file:

  1.   Open your Host file C:\Windows\System32\Drivers\etc\host;
    image
  2. In the host file put the IP address of your VPC 192.168.5.11 and set the host in my case that is scratch;
     image
  3. You should now be able to browse your SharePoint (Web Site) hosted on a VPC even if you do not have connection to a network;
    image 

How to perform a phased roll out of SharePoint MySites

November 15th, 2009 Dominick Cosgrove No comments

While working at an large utility organisation that has an Enterprise deployment of MOSS; they had their MySite Functionality turned off for all users. Now while I agree that there is a considerable amount of resource required to implement and manage the MySite functionality in SharePoint, it does have it’s benefits:

  • Aids SharePoint adoption as uses have Site Owner rights to their MySite, which means they can create Lists, Add Web Parts, Upload Documents e.t.c. giving them a full flavour of what SharePoint can do, in an isolated environment;
  • It can replace the user drive (U:\ drive or equivalent);
  • It can promote Sharing of information with colleges, rather than having silos of information on Shared Drives;
  • It can allow you to target information to particular sets of users;
  • It helps finding people by skills, roles, department, corporate structure e.t.c.

    One approach I find useful is to phase / incrementally deployment of MySites across the Enterprise. The following will show how you can achieve this:

    1. Within the Active Directory (AD) create a new group called “SharePoint MySite Users” or something similar, this should be created as per your corporate policy;

image

2. Add the users that you plan to initially grant access to MySites to the newly created Group. You can also add existing AD Groups to this groups; for instance if you wanted to add the IT department you could add a AD Group that contains all members of that Department;

image

3. Launch your Central Administration console and select the Shared Services associated the SharePoint Site. From the Shared Services Home page select Personalization services permissions;

image

4. This will launch the a permissions page where you can grant rights to various personalisation services. You will notice that by default the NT AUTHORITY\Authenticated Users have been granted Personal Features and Personal Site rights. We are interested in the Personal Site rights. We need to remove these rights from the Authenticated Users groups. To do this select the Authenticated Users, and click Modify Permissions of Selected Users;

image

5. On the Modify Permissions page deselect Create Personal Site and click Save;

image

6. From the Manage Permissions page select Add Users / Groups. On the Add Users / Groups page enter the group that you created in steps 1 & 2. You can use the people picker functionality to help find the group. Check the box next to Create Personal Site and click Save;

image

7. You will now see that the SharePoint MySite Users group has the rights to create personal sites;

image

8. To verify this log in to the Portal with an account that is a member of the SharePoint MySite Users group. You will see the link to the My Site in the top right corner of the standard SharePoint site template;

image

9. Now log in with a user who is not a member and you will notice that the My Site link no longer appears;

image

Using this approach you can safely deploy My Sites functionality across and enterprise in a controlled fashion. This will allow you to ensure quota’s, content database, site deletion e.t.c are provisioned as per the requirements (governance) of your organisation.

SharePoint 2010 Resources Announced

October 20th, 2009 Dominick Cosgrove No comments

image Microsoft opened SharePoint 2010 up to the public today at the SharePoint Conference 2009. With the announcement of the public beta being available in November 2009, they have made some resources available in preparation. The  SharePoint Team Site offer the following resources:

- SharePoint 2010 Website – to view SharePoint 2010 in action

- SharePoint 2010 forum- for SharePoint 2010 questions

- SharePoint 2010 PressPass- for the SPC 2009 keynote video, a Q&A with Jeff Teper…

- SharePoint 2010 Developer Centre – for developer info

- http://www.mssharepointitpro.com – for IT Pro info

- http://www.microsoft.com/sharepoint – for more SharePoint information

I’m sure there will be a plethora of information around 2010 over the next couple of weeks as the MVP community privileged to get a early beta copy, tear up the NDA which, has been keeping them silent and are let loose publish all their findings. Personally I can’t wait!

Categories: 2010, SharePoint Tags: ,

SharePoint Overflow

October 19th, 2009 Dominick Cosgrove No comments

The guys from the SharePoint Pod Show have recently launched a Q&A site called SharePoint Overflow which will not only allow the community to help solve SharePoint Dev, Admin, users Issues, but will also help provide content for their show. Well done guys!

http://www.sharepointoverflow.com/

p.s. PinkPetrol I’m liking the suggestion for the logo.

Categories: Random, SharePoint Tags:

Top SharePoint Dev Productivity Apps

October 19th, 2009 Dominick Cosgrove No comments

Ok, so there are loads of these sort of blogs already out there, but hey thought I’d let you know the suite of tools that I’ve added to my arsenal. All these tools should help make your SharePoint life allot easier… they definitely save me a load of headaches over the years. Thanks to all the community folks for developing these tools, with out them our lives would be a lot harder.

SharePoint Inspector

SharePoint Inspector is a free tool to browse your SharePoint 2007 farm.

You can see objects composing its structure, get their properties by reflection, which can be very useful when you want to check if your code does what it should do.
You can use also some advanced features like activate/deactivate SharePoint features, add/remove event receivers, manage your recycle bin. Thanks to Gaetan Bouveret great utility.

CAML.NET IntelliSense

The purpose of this project is to extend the raw WSS xsd to include annotated documentation taken from the SharePoint SDK so that developers don’t have to break their train of thought while they go searching for information about each element. Thanks to John Holliday for providing this.

U2U CAML Query Builder

The tool will help you build, test and execute your CAML Queries. This version of the tool only let you build CAML queries for execution against lists. Thanks to those Belgium guys at U2U.

.Net Reflector

This is something that should be in any .Net developer tool box. .NET Reflector enables you to easily view, navigate, and search through, the class hierarchies of .NET assemblies, even if you don’t have the code for them. With it, you can decompile and analyze .NET assemblies in C#, Visual Basic, and IL.

BDC Meta Man

BDC Meta Man is the first Business Data Catalog tool for all SharePoint Developers and Administrators interested in line of business data integration with SharePoint. Without writing a single line of code you can be viewing and searching across your business data through Microsoft Office SharePoint Server 2007 in minutes.

This is a great tool provided by the guys from Lightening Tools. The free to download version gives you some limited functionality.

Nick Swan and Brett Lonsdale the cofounders of Lightening tools have also produced a great book on the BDC “SharePoint 2007 Developer’s Guide to Business Data Catalog”. They can also be heard on the Excellent SharePoint Pod Show with co-host Rob Foster. Definitely check it out.

WSPBuilder

A SharePoint Solution Package (WSP) creation tool for WSS 3.0 & MOSS 2007
- No more manually creating the manifest.xml file.
- No more manually specifying the DDF file.
- No more using the makecab.exe application.

Carsten Keutmann you’re a legend… what more can I say!

SharePoint Manager 2007

The SharePoint Manager 2007 is a SharePoint object model explorer. It enables you to browse every site on the local farm and view every property. It also enables you to change the properties (at your own risk). This is a very powerful tool for developers that like to know what the SharePoint holds of secrets. Another great tool from Carsten Keutmann.

Fiddler

Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data.

AppPool Manager Neat little tool from Spencer Harbar.
SPSource

SPSource is a tool for SharePoint developers to assist in the creation of WSS Solution Packages (WSPs) allowing for the use SharePoint Designer and the SharePoint web UI to make quick changes to items, then push those items into Visual Studio for later compilation into a WSP. Thanks to Jeremy Thake.

STSAdm Extensions A must have suite of STSAdm commands from Gary Lapointe. Great for those SharePoint Administrators out there.
SPTraceView

SPTraceView analyses in real time the ULS trace messages coming from all MOSS components and can notify you using a balloon-style tray bar messages when something of interest happens.

SP Dispose Checker Tool

SPDisposeCheck is a tool to help you to check your assemblies that use the SharePoint API so that you can build better code. It provides assistance in correctly disposing of certain SharePoint objects to help you follow published best practice.

SharePoint Installer

This project is a Windows application for an eased and more user friendly installation and deployment of SharePoint 2007 solution files to a SharePoint server farm. Distribute your SharePoint solution files with this installation program instead of a raw script using STSADM.EXE to install and deploy the solution.

SharePoint Search Service Tool

The SharePoint Search Service Tool is a rich web service client that allows a developer to explore the scopes and managed properties of a given SharePoint Search SSP, build queries in either Keyword or SQL Syntax, submit those queries and examine the raw web service results. This tool can be useful in troubleshooting and verifying the behaviour and configuration of a SharePoint environment.

CodeRush

CodeRush for Visual Studio® .NET will help you create sophisticated code blocks in seconds and extend code templates instantly. CodeRush will complete identifiers as you type and expand or contract selections logically. With CodeRush, you will be able to instantly place selected code inside Try/Catch blocks, Regions and your own custom wrappers with ease.

ReSharper

ReSharper provides solution-wide error highlighting on the fly, instant solutions for found errors, over 30 advanced code refactorings, superior unit testing tools, handy navigation and search features, single-click code formatting and cleanup, automatic code generation and templates, and a lot more productivity features for C#, VB.NET, ASP.NET, XML, and XAML.

SharePoint Skinner Helps you define the theme css for your custom SharePoint sites.
Visual Round Trip Analyser

The Visual Round Trip Analyzer tool helps web developers and testers visualize the download of their page, identify best practices and changes that improve web performance. The network Round-Trip between the client and server(s) is the single biggest impact to web page performance – much greater than server response time.

YSlow YSlow analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages.

Backup File Size is different to what is displayed in the enumsites!

September 10th, 2009 Dominick Cosgrove No comments

While assisting a client in moving content from one environment to another for testing purposes, it was noticed that the site of the stsadm backup file was considerably larger than the Content Database size as defined in the stsadm enumsites report.

As can be seen in the from the out put of the enumsites, the StorageUsedMB for the HRTemp site collection is reported to be 158.4 MB. However the size of the backup file is 3.1 GB.


<Sites Count="5">  <Site Url=http://portal Owner="domain\spadmin" ContentDatabase="WSS_Content"StorageUsedMB="1.7" StorageWarningMB="0" StorageMaxMB="0" />  <Site Url="http://portal/teamsite/hr" Owner="domain\spadmin"  ContentDatabase="WSS_Content_HR2" StorageUsedMB="3171.1" StorageWarningMB="0" StorageMaxMB="0" />  <Site Url="http://portal/teamsite/HRTemp" Owner="domain\spadmin"  ContentDatabase="WSS_Content_Temp" StorageUsedMB="158.4" StorageWarningMB="0" StorageMaxMB="0" />  <Site Url="http://portal/teamsite/it" Owner="domain\spadmin" ContentDatabase="WSS_Content_IT" StorageUsedMB="8840.7" StorageWarningMB="0" StorageMaxMB="0" />  <Site Url="http://portal/teamsite/research" Owner="domain\spadmin" ContentDatabase="WSS_Content_Research" StorageUsedMB="14.5" StorageWarningMB="0" StorageMaxMB="0" /></Sites>
 
I asked if they had deleted any files and if so had they deleted the files from the recycle bin. They said that they had deleted files and removed them from the recycle bin. As it transpires they had removed the files from the users recycle bin and not the site collection recycle bin. 

image

Once the files were removed from the site collection recycle bin the backup file was reduced to the expected size.

It is therefore important to ensure that files are deleted and removed from the recycle bin properly before executing a stsadm backup as files in the recycle bin for the site collection will also be backed up and this will not be reflected in the enumsites report.

Note: You can disable the recycle bin thus purging the recycle bin using the setproperty method of the stsadm command. Beware that this property is for the Web Application and not the site collection, and will as a result empty (delete) the recycle bins for all site collections in the web application. This is OK for testing purposes, but not recommended in production environments.

SharePoint Feature Scopes

August 6th, 2009 Dominick Cosgrove No comments