August 25, 2011 - 17:28, by Steven Van de Craen
Categories: InfoPath, SharePoint 2003, SharePoint 2007, SharePoint 2010
A short blog on how the Promoted Fields seem to behave for InfoPath forms stored in SharePoint.
They are created as fields (Date, Text, …) and have the XPath property configured to the field in InfoPath (example: /my:myFields/my:field1)
When the form is stored in the library, the value of the XPath’s InnerText is stored in the List Item. It is by no means a live evaluation of the XPath.
Through code one can update the XPath value of the SPField. This does not affect existing forms since the value is persisted during form save, only new forms are affected.
SPSite site = new SPSite(url); SPWeb web = site.OpenWeb(); SPList list = web.GetList(url); SPField field = list.Fields["Field1"]; field.XPath = "/my:myFields/my:field1"; field.Update();
When you set the XPath to an element that has child elements, the InnerText will render all the elements contents as you’d expect:
value 1
value 2
When the XPath is set to "/my:myFields”, the Promoted Field value will be “\n\t11\n\t22\n” (it preserves indents).
That’s all for this quick blog post !
November 12, 2009 - 11:58, by Steven Van de Craen
Categories: .NET, SharePoint 2003, SharePoint 2007
November 12, 2008 - 14:37, by Steven Van de Craen
Categories: IIS, SharePoint 2003, SharePoint 2007
Introduction
If you want to integrate you ASP.NET Application or Web Service in SharePoint 2007 there are some ways to do it. If there's no requirement in making it contextual (*) then you can just drop it in the root folder of the SharePoint IIS site.
(CustomerApp is a virtual directory, CustomerApp2 is a virtual application)
*: if you want your ASP.NET application, page or web service you can drop it in the LAYOUTS or ISAPI virtual path and it will be available for any SharePoint web via http://weburl/_layouts/yourapp or http://weburl/_vti_bin/yourapp. Your code could then get a reference via SPContext.Current.Web or SPContext.Current.Site.
What to choose
So do you create a virtual directory or a virtual application ? What are some key differences besides the icon in IIS Manager ?
virtual directory
- can access all application specific data (Application variables, Cache, Session, ...) from the parent application
- not all settings in web.config are allowed on virtual directories and must be done in parent application's web.config
- assemblies must be put in parent's BIN or in the GAC
virtual application
- can use the same or different application pool as the parent application
- does not share application-specific data (Application variables, Cache, Session, ...)
- assemblies must be put in local BIN folder or in the GAC
- can have specific settings regarding authentication/authorization in IIS or web.config
Additional info
-
Understanding Sites, Applications, and Virtual Directories in IIS
-
Wenlong Dong's Blog - Virtual Application vs Virtual Directory
-
IIS 6.0 -Applications,Sites,Virtual Dir… « Sankarsan’s Journal
-
What about Extended Web Applications (EWA)
With SharePoint it is possible to create an extended Web Application that points to the same content but allows you to configure it with different URL, authentication, authorization, etc. However this creates a second IIS site in the same application pool but as a different application and thus plays by the same rules as above:
- The extended Web Application does NOT share application-specific data with the 'source' Web Application
- Warm-up scripts are application-specific; if your pages are hit via http://intranet then they must still be separately hit via any other URL if that URL is defined via a different Web Application
Just something I needed to write down for personal reference. If it is any benefit to others then even better...
April 17, 2008 - 13:24, by Steven Van de Craen
Categories: SharePoint 2003, SharePoint 2007, General
April 2, 2008 - 14:17, by Steven Van de Craen
Categories: General, SharePoint 2003, SharePoint 2007
Yesterday I got notice about being awarded MVP for SharePoint Server ! At first I figured it to be an April Fool's joke but no such thing :)
I'm really loving this !!!
January 17, 2008 - 11:58, by Steven Van de Craen
Categories: Office 2003, Office 2007, SharePoint 2003, SharePoint 2007
If the Online Presence Indicator is not working properly on some clients it could be that the IE plugin is corrupted.
Client has Office 2003
Try reinstalling the Office Web Components.
Client has Office 2007
Try the following:
- Close all IE windows
- Rename the file C:\Program Files\Microsoft Office\Office12\name.dll to name.dll.bak (or delete it)
- Start MSN Messenger / Live Messenger / Windows Messenger (not sure why but it did the trick)
- Open a SharePoint page in IE and Office 2007 will reconfigure itself
Helped in my case !
December 6, 2007 - 17:09, by Steven Van de Craen
Categories: .NET, SharePoint 2003, SharePoint 2007
There are some things you need to know as a SharePoint developer...
Creating a list
When you create a list using the browser you get to specify the name for the list. Basically this means both the url part as the title. Not all characters are allowed in a URL so SharePoint will just filter them out of the url part WITHOUT NOTICE !
The example above will create a list at location http://moss/My%20List1d with title 'My List??1..d'.
When you create a list using the Object Model you also specify the url part and title as one parameter and invalid characters get stripped from the url part.
Renaming a list
When a list is created it cannot be renamed. Well, you can change the title but not the url part. I use this technique quite often as follows:
- Create a list named 'kb'
- Rename the list to 'Knowledge Base'
This way the url part remains short while your users see a more descriptive title. I always tend to avoid spaces and exotic characters in the url part. Too bad they don't allow this separation at list creation time...
Caveat
There could be some confusion when you have the following situation:
- You have a list named 'Questions' (http://moss/Lists/Questions)
- You create a new list named 'Questions ???'
Guess the outcome ? The new list contains some illegal URL characters which will be stripped. However there exists a list with the same url part already...
Answer: The new list is created successfully at the following location: http://moss/Lists/Questions1
The '/Lists' segment
If you notice the URL of some lists and libraries you might notice the difference. Some of them have the '/Lists' segment and others dont.
In general:
- Lists with files: root location of the web. Example: http://moss/MyDocLib
- Other lists: '/Lists' segment. Example: http://moss/Lists/MyAnnouncements
Exceptions (found so far):
- A Site Directory 'Sites' List (type: enhanced Links List) lives in the root location of the Site Directory web
Get the instance of a list in code
When you write SharePoint code and you need to get the instance to the list you have some options:
1. Using SPFolder.ParentListId
This only works for libraries since the list has to support folders. You can get to the root folder of the document library and then get the parent list id as Guid. In turn this id can be used to get to the SPList instance.
Possibilities:
- web.Folders["url part"].ParentListId
- web.Folders[web.Url + "/url part"].ParentListId
- web.Folders[web.ServerRelativeUrl + "/url part"].ParentListId
- web.Folders[site.MakeFullUrl("url part")].ParentListId
Instead of using web.Folders[url] you can also use web.GetFolder(url)
2. Using SPWeb.Lists[title]
This works for all types of lists and uses the title or list id. The latter can be used in combination with the SPFolder.ParentListId method.
Possibilities:
- web.Lists["title"]
- web.Lists[listId]
3. Using SPWeb.GetList(url)
This works for all types of lists and uses the absolute or relative url. It cannot the url part in itself so if you only have that it must be made into a absolute or relative url.
Possibilities:
- web.GetList[web.Url + "/url part"]
- web.GetList[web.ServerRelativeUrl + "/url part"]
- web.GetList[site.MakeFullUrl("url part")]
-
4. Using SPWeb.GetListFromUrl(url)
This works for all types of lists and uses the absolute or relative url to a form. (not just any file !)
Possibilities:
- web.GetListFromUrl["url part/Forms/AllItems.aspx"]
- web.GetListFromUrl[web.Url + "/url part/Forms/AllItems.aspx"]
- web.GetListFromUrl[web.ServerRelativeUrl + "/url part/Forms/AllItems.aspx"]
- web.GetListFromUrl[site.MakeFullUrl("url part/Forms/AllItems.aspx")]
-
5. Using SPWeb.GetListFromWebPartPageUrl(url)
Seems to be identical to the above method. It doesn't seem to work with a Web Part Page url so I'm not sure what additional features it offers.
Possibilities: same as 4.
Alternative
If you're in the context of SharePoint and displaying an item or form in a list or library you can use the following:
Conclusion
It's possible to store a reference to a specific list using the title, the url or url part, or the ID in combination with the web url. Since the list title is subject to change by anyone with sufficient permissions You shouldn't rely on it to find the specific list. The title should be used for display but the url part or ID should be used to work with behind the scene.
Also, nothing prevents you from having two lists with the same title on the same web. This might be confusing but can be prevented by user education or by providing the url along with the title.
Think of this when designing your web parts, win apps, etc.
November 23, 2007 - 10:09, by Steven Van de Craen
Categories: SharePoint 2003, SharePoint 2007
One of our MOSS servers was not sending out any alert notifications anymore. I'm not sure when it stopped working but recently users started complaining about it.
When I subscribe to a new alert I still get the 'New alert' notification, but that's actually a different mechanism than the actual alerts.
I double checked my antivirus settings but no luck.
Then I found some posts regarding the job-immediate-alerts property:
stsadm -o getproperty -propertyname job-immediate-alerts -url http://moss
stsadm -o setproperty -propertyname job-immediate-alerts -url http://moss -propertyvalue "every 5 minu
tes between 0 and 59"
Operation completed successfully.
stsadm -o getproperty -propertyname job-immediate-alerts -url http://moss
If you get that the property doesn't exist you need to set it in order to get immediate alerts working again. There are a lot of these properties that can be configured:
WSS 2.0: http://office.microsoft.com/en-us/winsharepointadmin/HA33.aspx
WSS 3.0: ? (a lot of the WSS 2.0 properties apply)
August 21, 2007 - 08:24, by Steven Van de Craen
Categories: SharePoint 2003, SharePoint 2007
Problem
You receive a notification about an alert being created for a SharePoint List but receive no actual alerts after that.
Cause
Alerts not being received can be caused by so many things but one of the possible causes is your antivirus software on the SharePoint Server.
Our antivirus software has port blocking rules to prevent mass emailing by malicious programs and it needs to be configured to exclude SharePoint from this rule.
Solution
Configure the OWSTIMER.EXE (SharePoint's Timer Process) to allow to send emails in your antivirus software.
July 24, 2007 - 11:43, by Steven Van de Craen
Categories: SharePoint 2003, SharePoint 2007
General
When creating sites through the SharePoint Object Model, the Web Services or the Web Interface you need to filter the illegal characters when specifying the Site Name (which is the part of the URL that references your site).
Here's a list of common illegal characters: # % & * { } \ : < > ? / +
In addition to this list it is prohibited to have consecutive periods in the URL. It's also prohibited to start or end with a space or underline, or to end with a period.
I've found out by experience that non-consecutive periods in Site Names are allowed, but then MOSS 2007 Search doesn't show these sites in its results, so it's best to have no period at all in your Site Name.
Finally there's the comma. It's not on the illegal character list, but be cautious when allowing it. If you add a link to that site through the SharePoint Object Model you might run into problems because the URL Field stores both URL and Description separated by ', ' (a comma followed by a space). The code will think your comma is part of the separator. This in turn can be solved using an UrlEncode but this is easily overlooked.
Code Sample
// Use SPUrlUtility for removal of illegal characters: # % & * { } \ : < > ? /
int illegalCharIndex = SPUrlUtility.IndexOfIllegalCharInUrlLeafName(newSiteName);
while (illegalCharIndex > -1)
{
newSiteName = newSiteName.Remove(illegalCharIndex, 1);
illegalCharIndex = SPUrlUtility.IndexOfIllegalCharInUrlLeafName(newSiteName);
}
// Extra removal of illegal characters ignored by SPUrlUtility: + . ,
newSiteName = newSiteName.Replace("+", "");
newSiteName = newSiteName.Replace(".", "");
newSiteName = newSiteName.Replace(",", "");
// Removal of leading/trailing spaces and underscores
newSiteName = newSiteName.Trim(' ', '_');
You could of course avoid SPUrlUtility and manually strip all illegal characters, which might be less trouble alltogether.
Applies To
WSS 2.0, WSS 3.0
Next >>