Skip to main content

Thinking out aloud - Dave Hunter's SharePoint Blog

Go Search
Home
Blog
  

Locations of visitors to this page


 Useful Links

  Microsoft UK events
  SharePoint 2007 on CodePlex
  SharePoint Community Portal
  SharePoint User Group
  SharePoint Community Portal
  SharePoint Pedia
  SharePoint MSDN Forums
  SharePoint University

 Other Blogs

  Andrew Connell
  Angus Logan
  Arpan Shah
  Bill English
  Charles Emes
  Chris Hines
  From the field
  Heather Solomon
  Joel Oleson
  Lawrence Liu
  Mark Harrison
  MCS UK SharePoint Team
  Microsoft ECM
  Nick Mayhew
  Patrick Tisseghem
  Penny Coventry
  SharePoint Team
  Stefan Gossner
  Todd Bleeker
Home > Thinking out aloud - Dave Hunter's SharePoint Blog
My thoughts and findings on Microsoft Information worker technologies, including MCMS, SharePoint 2007 (MOSS) and SharePoint 2010.
I’ve been Awarded a MVP for SharePoint

I’m proud to announce that I have been awarded a Microsoft Most Valuable Professional (MVP) for my efforts in the community.

“Congratulations! We are pleased to present you with the 2010 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in SharePoint Services technical communities during the past year”

I hope to continue my efforts on the MSDN Forums, publish new content on my blog on a regular basis and support the community to prove the award is deserved.

MVP

SharePoint 2010 Training on Microsoft E-Learning

I can’t believe I’ve only just came across this … The free SharePoint 2010 developer training on Microsoft E-Learning today.  Have a look at:

Clinic 10277: What’s New in Microsoft SharePoint 2010 for Developers https://www.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=160329&tab=overview

Also one for IT Pros https://www.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=161467&tab=overview

Apparently the offer is only available for a limited time.

Enjoy!

SharePoint UK User Group - Thursday 27th August London Meeting

I was planning to attend the SharePoint UK User Group on Thursday for the Best Practices in Gathering Requirements for SharePoint Projects.  The event had Dux speaking at the event.

Important news, Dux can't make the event so its now going to be a virtual event instead of being held at Microsoft's offices in Victoria London.  Please see an update here http://suguk.org/forums/thread/20502.aspx.

CAML Query that filters on the current user

CAML Queries are troublesome at the best of times.  I find it best to use a tool or a tried and tested method like the one I use here Tip - Creating CAML Queries - Thinking out aloud - Dave Hunter's.

When you create a view and you want to show only items that have been created by the current user you use the [Me] keyword.  For example: filter by "Author" equals [Me].

How can I do this using a CAML query?

The [Me] keyword is represented in CAML by the following <Value Type="Integer"><UserID Type="Integer"/></Value>.  In the CAML query for returning items that the current user has created becomes ...

<Where><Eq><FieldRef Name='Author' /><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where>

Mirjam has done a good job of writing this up http://www.sharepointblogs.com/mirjam/archive/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user-or-me.aspx.  Glad I could help.

Microsoft Ramp Up Free SharePoint Developer Training

Microsoft Ramp Up http://msdn.microsoft.com/en-us/rampup/default.aspx has been about for a while now but not everyone knows about this training.  Microsoft Ramp Up offers free online community based learning to help you build up on your development skills.  There are many tracks which include:

  • Move from ASP to ASP.NET
  • Learn ASP.NET: for PHP Developers
  • Web Development with ASP.NET
  • Develop Windows Mobile 6 Applications
  • SharePoint for Developers Part 1
  • SharePoint for Developers Part 2
  • Visual Studio 2008
  • Developer Basics
  • Java Developer: Learn .NET
  • VB6 Developer: Lean VB 2005
  • VS 2002/2003 Developer: Learn VS 2005

Something for everyone.

The SharePoint track is available here: part 1 http://msdn.microsoft.com/en-us/rampup/dd221355.aspx and part 2 http://msdn.microsoft.com/en-us/rampup/dd320759.aspx

How To: Change a SharePoint Application Pool Programmatically

Central Administration has a screen allow users to change the application pool identity, but doesn't allow you to change the application pool which the web application uses.  You can modify manually by opening IIS, changing the application pool and making changes to the metabase.xml.  But how do I make these changes programmatically?

Theory

An IIS Web Site in SharePoint is represented by the SPWebApplication class http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.aspx this has a property called ApplicationPool which allows to be retrieved and set http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.applicationpool.aspx

Code

System.Uri webAppToChangeUri = new System.Uri("http://intranet");
SPWebApplication webAppToChange = SPWebApplication.Lookup(webAppToChangeUri);
webAppToChange.ApplicationPool.Name = "ALL MOSS";
webAppToChange.Update(true);

webAppToChange.Provision();

Demo

I ran this code inside a windows form, you can use this or a console application.  The current application pool and the one I want to change it to has the same identity, so I just changed the ApplicationPool Name.  If your identify is different you will need to set the Username and Password properties as well.

Before running the code the intranet web application has the following properties

Before

After I run the code, right click IIS Manager and click refresh.  I open the properties of the intranet web application and check the settings have came through.

After

That's it.

Why change the application pool?

For every application pool a w3wp process will be launched and can consume large amounts of memory.  You need to find a good balance of isolation (provided by having many application pools) and consumption of memory.  Have a look at Joel's article here http://blogs.msdn.com/joelo/archive/2007/10/29/sharepoint-app-pool-settings.aspx

SharePoint Forums Topping 100 Answers

I haven't been very active on the blog for a while as I have been busy with work and active on the SharePoint Forums, particularly the SharePoint Developer Forum http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/threads

It's rewarding to help people with their SharePoint issues.  Recently I got credited with answering 120 questions in 30 days, this isn't just a reply to the question, its to provide a resolution to their issue helping them solve their problem.

My profile http://social.msdn.microsoft.com/Profile/en-US/?user=Dave%20Hunter

spdev_topanswers2

Find out the SharePoint Internal Name for a Column or Site Column

When you create a column on a list or site column in SharePoint through the user interface you enter the column name, type and any other properties.  The name is used for the internal name and display name.  The internal name is escaped to remove any special characters and spaces.  The table below displays the list of characters and their escaped version.

Character

Hex Code

Escaped Version

[space]

20

_X0020_

|

7C

_X007C_

-

2D

_X002D_

\

5C

_X005C_

(

28

_X0028_

)

29

_X0029_

'

27

_X0027_

,

2C

_X002C_

!

21

_X0021_

%

25

_X0025_

&

26

_X0026_

?

3F

_X003F_

$

24

_X0024_

£

A3

_X00A3_

"

22

_X0022_

<

3C

_X003C_

>

3E

_X003E_

=

3D

_X003D_

#

23

_X0023_

 

The following are examples of this escaping:

Name entered

Escaped Version

Published Date Published_X0020_Date
Buyer's Name Buyer_X0027_s_X0020_Name
Zip / Postal Code Zip_X0020__X002F__X0020_Postal_X0020_Code

 

Please note: The internal name has a maximum length which is calculated after the internal name has been escaped.

There are a few way's to check the internal name, one of which is the through the User Interface, here's how:

1.  Open a web browser.

2.  If you have created a site column open the site column gallery, if you created a column on a list open the list settings.

3.  Click on the column name.

4.  Check the URL for the "field" querystring parameter, as you see from the screenshot below it contains the internal name.

column

 

Other ways include ...

using .NET

You can also find out the escaped version using the System.Xml namespace and the XmlConvert.EncodeName.  For example:

using System.Xml;

// encode the column name
string escapedString = XmlConvert.EncodeName("Published Date");

// decode the escaped column name
string normalString = XmlConvert.DecodeName(escapedString);

which produces

escapedString = Published_X0020_Date

normalString = Published Date

 

Content Types Viewer

Download it here MOSS Content Types Viewer - Home

More about the Content Type Viewer http://www.davehunter.co.uk/Blog/Lists/Posts/Post.aspx?ID=100.

You can browse to the SharePoint environment, browse the content types and investigate the columns which are associated to the content type chosen, using the "show fields" button.

 

Controlling the internal name

You can control the internal names when you provision the site columns using a feature.  You can also do this using the User Interface by creating a field without any spaces or special characters and then re-edit the column to change the display name with any characters you wish.

 

Hope this helps

Delving into Deploying SharePoint Artifacts with Features

I've seen many posts on forums with features deploying site collection features scoped at the web level.  Admittedly there is confusing factors, articles freely use the term site for a site collection and site for a sub site.  I hope by the end of reading this article it will be more clear.

The feature framework can deploy the following:

  • Masterpages
  • Page Layouts
  • Stylesheets
  • Images
  • Documents
  • WebPart Pages
  • WebPart Definitions 
  • List Definitions
  • List Instances
  • Content Types
  • Site Columns
  • Custom Actions

Features that should be scoped at the Site level (Site Collection).

  • Site Columns
  • Content Types
  • Provisioning Masterpages
  • Feature Receivers
  • Stapler
  • WebPart Definitions (.dwp or .webpart) to WebPart Gallery

Features that should be scoped at the Web level (SPWeb)

  • List Instances
  • List Definitions
  • Custom Actions / Hide Custom Actions
  • Web Part Pages
  • Document, Images provisioned to libraries
  • Content Type Bindings
  • Event Receivers
  • Feature Receivers

Features that should be scoped at the WebApplication level (Web Application)

  • Custom Actions / Hide Custom Actions
  • Stapler

Features that should be scoped at the Farm level

  • Stapler
  • Custom Actions / Hide Custom Actions

Examples:

  • Provisioning Site Columns
  • Provisioning Content Types
  • Provisioning List Instances
  • Provisioning List Templates
  • Provisioning Web Part Pages including Web Parts
  • Provisioning Folders
  • Provisioning Documents
  • Provisioning Custom Actions and Hiding
  • Provisioning MasterPages
  • Provisioning Page Layouts
  • Site Stapling
  • Provisioning WebParts in the WebPart Gallery
  • Content Type Bindings
SharePoint - Connecting MySites with the Portal

With your typical intranet with MySites scenario you have two front-end web applications, one hosting your intranet and the other hosting your MySites.  These are two separate components.  MySites are a shared service, they are designed to be consumed by one or many web applications.  Out of the box they aren't linked to a web application hosting your intranet.

When a user creates a MySite they may ask you "how do I get back to the intranet?".  You can do this by setting the Portal Connection.

First take a look at my environment

Web Application

Purpose

http://intranet

SharePoint collaboration environment for internal staff

http://mysites

Hosting MySites

   

  1. Browse to the MySite host settings page.  In my case this is http://mysites/_layouts/settings.aspx
  2. Click on the "Portal Connection" link
  3. Enter the URL to the site you wish to connect to.  In my case this is http://intranet
  4. Enter a descriptive name
  5. Click OK.
1 - 10 Next
  Copyright
This work is licenced under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.0 UK: England & Wales License
  Site Map

I'm currently a Senior Consultant at Netstore 2e2. I specialise in Microsoft Information Worker technologies (especially MOSS, MCMS and .NET), with over 10 years of experience within this area of specialism. 

 

Follow davehunter on Twitter

 

 

  Subscribe in a reader


 Latest Posts

Expand/Collapse Year : 2010 ‎(2)
Expand/Collapse Month : 04 ‎(1)
Expand/Collapse Month : 03 ‎(1)
Expand/Collapse Year : 2009 ‎(17)
Expand/Collapse Month : 08 ‎(1)
Expand/Collapse Month : 07 ‎(4)
Expand/Collapse Month : 05 ‎(1)
Expand/Collapse Month : 04 ‎(2)
Expand/Collapse Month : 03 ‎(6)
Expand/Collapse Month : 02 ‎(3)
Expand/Collapse Year : 2008 ‎(31)
Expand/Collapse Month : 12 ‎(1)
Expand/Collapse Month : 11 ‎(4)
Expand/Collapse Month : 10 ‎(5)
Expand/Collapse Month : 06 ‎(3)
Expand/Collapse Month : 05 ‎(1)
Expand/Collapse Month : 04 ‎(3)
Expand/Collapse Month : 03 ‎(3)
Expand/Collapse Month : 02 ‎(5)
Expand/Collapse Month : 01 ‎(6)
Expand/Collapse Year : 2007 ‎(59)
Expand/Collapse Month : 12 ‎(3)
Expand/Collapse Month : 11 ‎(6)
Expand/Collapse Month : 08 ‎(3)
Expand/Collapse Month : 07 ‎(27)
Expand/Collapse Month : 06 ‎(17)
Expand/Collapse Month : 05 ‎(3)