Web Part Properties and the Event Life Cycle


November 30, 2007 - 12:12, by Steven Van de Craen - 0 Comments

Something I noticed during Web Part development was that the Web Part Properties were not loaded at constructor call time. Makes sense since the control has to be instanciated before the properties can be loaded but I recently forgot and it had me troubled for a while.

Q. So when are the Web Part Properties loaded ?

A. If you keep the event life cycle in mind then the Web Part Properties are loaded right after the constructor call. So anywhere else you can use them safely.


Search Server 2008: installation gimmick


November 30, 2007 - 11:15, by Steven Van de Craen - 0 Comments

I just installed the Release Candidate of Microsoft Search Server 2008 Express edition. Although the documentation mentioned a Basic and Advanced installation I didn't get that option.

Another thing I noticed:

 

SharePoint is everywhere :)


SharePoint: Immediate alert notifications stopped working


November 23, 2007 - 10:09, by Steven Van de Craen - 19 Comments

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
<Property Exist="No" />

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
<Property Exist="Yes" Value="every 5 minutes between 0 and 59" />


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/HA011608451033.aspx
WSS 3.0: ? (a lot of the WSS 2.0 properties apply)


SharePoint Search: Basic Authentication issues


November 22, 2007 - 17:15, by Steven Van de Craen - 1 Comments

One of our MOSS 2007 servers has a single Web Application (no extended Web Apps) and is configured to use Basic Authentication. I have confirmed that my dedicated crawl account has sufficient permissions in the Policy for Web Application section of Central Administration > Application management.

I try to start a full crawl of the local SharePoint content but it keeps throwing the following error:

Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (The item was deleted because it was either not found or the crawler was denied access to it.)

So I extended the main Web Application and configured it to use Integrated Windows Authentication. I edited the Local SharePoint Content Source and set it to use the URL of the extended Web Application and guess what, it started indexing my content again.

Bottom rule

Always make sure there is a Web Application (extension) configured with Integrated Windows Authentication. You can keep it internal and hidden if you like. Preferably it is the default zone. Public URL's that use a different authentication mechanism should always be configured on an extended Web Application.


SOAP Exception: Maximum retry on the connection exceeded


November 22, 2007 - 10:12, by Steven Van de Craen - 0 Comments

Setup

On of my current projects is a custom solution for Microsoft Dynamics NAV to communicate with SharePoint using a Web Service. In order to do this you need to install the SOAP Toolkit (on the server and any clients running the code) to build a SOAP Message in C/AL code.

C/AL

// Create SOAP message
CREATE(AutSoapHttpConnector);
CREATE(AutSoapSerializer);
CREATE(AutXMLDocument);
AutSoapHttpConnector.Property('EndPointURL', 'http://moss.litwareinc.com/_ws/customservice.asmx');
AutSoapHttpConnector.Property('Timeout', '9000');
AutSoapHttpConnector.Connect;
AutSoapHttpConnector.Property('SoapAction', 'http://vandest/webservices/HelloWorld');
AutSoapHttpConnector.BeginMessage;

AutSoapSerializer.Init(AutSoapHttpConnector.InputStream);
  AutSoapSerializer.StartEnvelope('SOAP', 'NONE');
  AutSoapSerializer.StartBody;
  AutSoapSerializer.SoapDefaultNamespace('http://vandest/webservices');
    AutSoapSerializer.StartElement('CreateHelloWorld');
    ...

Problem

Maximum retry on the connection exceeded. HRESULT=0x80004005: Unspecified error - Connector: Unspecified HTTP error. HRESULT=0x800A1518

Solution

Don't use the Fully Qualified Domain Name (FQDN) of the computer running the Web Service, instead use the NETBIOS Name:

AutSoapHttpConnector.Property('EndPointURL', 'http://moss/_ws/customservice.asmx');

http://support.microsoft.com/kb/892964


SharePoint 2007 and PDF indexing


November 21, 2007 - 15:16, by Steven Van de Craen - 55 Comments

Introduction

By default the SharePoint 2007 Search indexed only the meta data of a PDF document. By installing and configuring a PDF IFilter the Search will also index the contents of the PDF document. This allows users to find documents based on text inside the document. This process is called full text indexing.

[Indexing Server]: the server(s) in the SharePoint Farm that has/have the "Indexing" Role assigned. In a small farm this can be a single server for all roles.

[Web Front End Server]: the server(s) in the SharePoint Farm  that has/have the "Web Front End" Role assigned. In a small farm this can be a single server for all roles.

Windows SharePoint Services 3.0

[Indexing Server]

  1. Install the PDF IFilter (see below for a list of available IFilters)
  2. Add the .pdf file type to the index list:
    1. Open the Registry Editor (Start > Run > regedit)
    2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\<GUID>\Gather\Search\Extensions\ExtensionList
    3. Add a new String Value
      1. Value name: <next value in line>
      2. Value data: pdf
  3. [This step only applies to 64 bit servers]
    1. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
    2. Change the (Default) key value
      1. Old value: {4C904448-74A9-11D0-AF6E-00C04FD8DC02}
      2. (Foxit  x64 PDF IFilter) New value: {987F8D1A-26E6-4554-B007-6B20E2680632}
      3. (Adobe  x64 PDF IFilter) New value: {E8978DA6-047F-4E3D-9C78-CDBE46041603}
  4. Perform an iisreset
  5. Perform a Full Update on the Search content indexes
    1. Open a Command Prompt on the Indexing Server
    2. net stop spsearch
    3. net start spsearch
    4. cd "C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\BIN"
    5. stsadm.exe –o spsearch -action fullcrawlstop
    6. stsadm.exe –o spsearch -action fullcrawlstart

[Web Front End Server]

  1. Copy the ICPDF.GIF () file to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images"
  2. Edit the file C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml\DOCICON.XML
    1. Add an entry for the .pdf extension
      <Mapping Key="pdf" Value="icpdf.gif"/>

Microsoft Office SharePoint Server 2007

[Indexing Server]

  1. Install the PDF IFilter (see below for a list of available IFilters)
  2. Add the .pdf file type to the index list:
    1. Go to Central Administration, then to the Shared Services Administration Web of the current SSP, go to Search Settings and next to File Type
    2. Add a new file type pdf
  3. [This step only applies to 64 bit servers]
    1. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
    2. Change the (Default) key value
      1. Old value: {4C904448-74A9-11D0-AF6E-00C04FD8DC02}
      2. (Foxit  x64 PDF IFilter) New value: {987F8D1A-26E6-4554-B007-6B20E2680632}
      3. (Adobe  x64 PDF IFilter) New value: {E8978DA6-047F-4E3D-9C78-CDBE46041603}
  4. Perform an iisreset
  5. Perform a Full Update on the Search content indexes
    1. Open a Command Prompt on the Indexing Server
    2. net stop osearch
    3. net start osearch
    4. Go to Central Administration, then to the Shared Services Administration Web of the current SSP, go to Search Settings and start a full crawl of all locations containing PDF files

[Web Front End Server]

  1. Copy the ICPDF.GIF () file to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images"
  2. Edit the file C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml\DOCICON.XML
    1. Add an entry for the .pdf extension
      <Mapping Key="pdf" Value="icpdf.gif"/>

Available IFilters

Adobe PDF IFilter 6.0 - x64

  • free (always good !)
  • 32 bit and 64 bit (64 bit released recently, applies to the [Indexing Server])

Foxit PDF IFilter v1.0

  • free for desktops, servers require a license
  • 32 bit and 64 bit (IA64 currently being tested, applies to the [Indexing Server])

Conclusion

Using the above procedure for either WSS 3.0 or MOSS 2007 it is possible to have your PDF document's contents indexed by the SharePoint Search.

References

Other


Tech Ed 2007: Day 5


November 12, 2007 - 10:27, by Steven Van de Craen - 0 Comments

Time sure flies when you're having fun. It has been an exciting week with a lot of interesting sessions which I have blogged about the last couple of days. Following now will be a variety of workshops for my colleagues at home about the new things we picked up here.

The flight back was at 5:30 PM so I didn't get to visit all of the sessions. Luckily the session recordings will be made available for download and on DVD soon.

Microsoft Office Excel and Analysis Services: An In-Depth Look at Integration (Dany Hoter)

Well actually I didn't want to go to the SharePoint Designer session so I decided to go to this one since a part of MOSS 2007 is focused on BI. It became painfully obvious that I didn't belong there; I'm just not interested in writing Excel formulas to access cube's.

ASP.NET Model View Controller (MVC)

Matt Gibbs discusses the Model View Controller. It sure looks promising but there's still a lot of work, also I can't really see it useable in my day to day projects for SharePoint. I'll just wait until it matures more and then we'll see if we can catch up on this new methodology/framework.

Day 1: 5th November 2007
Day 2: 6th November 2007
Day 3: 7th November 2007
Day 4: 8th November 2007
Day 5: 9th November 2007


Tech Ed 2007: Day 4


November 8, 2007 - 22:38, by Steven Van de Craen - 0 Comments

My head feels as if had single-handedly emptied the Sal Cafe's wine cellar... But other than the after effects I'm currently experiencing I had a great time at the Tech Ed Country Drink for Belgians and Luxemburgers.

Workflow in Microsoft SharePoint Products and Technologies 2007

This session on workflow was supposed to be level 400 but I found it to be more of a level 200 session. There's always a trade off you need to make for presentations and demo's but for level 400 one should assume the audience already has the basic knowledge.

Presentation was delivered by Ted Pattison and code monkey David Gristwood. Very solid and entertaining.

ASP.NET AJAX with SharePoint including Microsoft Silverlight and Popfly

My fellow countrymen Patrick Tisseghem and Jan Tielens gave some nice demo's on ASP.NET Ajax integration into SharePoint, discussing the specifics of getting it to work (web.config additions, adding the ScriptManager and more), and Silverlight and Popfly integration.

The more I see of Silverlight (they demoed both 1.0 and 1.1) the more impressed I am by it. Now I'm not a designer but there's a lot of potential in bringing your data in a fancier way.

The Popfly integration is really easy. Since Popfly always lives on the http://www.popfly.ms web site, it is just a matter of displaying the info in an iframe. Couldn't be easier !

SharePoint - the How's, Why's, When's and What's for Successful Development and Deployment (Q&A)

The session was a continuation of the Q&A round yesterday but there were a lot of improvements to the presentation (like microphones). This time there was an entire panel of specialists ready to answer the audience's questions. The panel consisted of Ted Pattison, Patrick Tisseghem, Jan Tielens, Joris Poelmans, Wouter van Vugt and Katrien De Graeve.

I'm glad I got to ask my question which had me bothered for some time now...

Building Solutions with the Business Data Catalog and Microsoft Office SharePoint Server 2007

Nick Swan, definitely an expert on the BDC, delivers a really cool session with some interesting demos. I really feel I could have done some of my projects using the BDC.

He shows a nice way to update the back-end system by implementing Generic Invoker methods. Now you still need to write the update logic of course, but it opens up a lot of opportunities. I'm not quite sure if you can do it for all systems without going into some unsupported state.

Day 1: 5th November 2007
Day 2: 6th November 2007
Day 3: 7th November 2007
Day 4: 8th November 2007


Tech Ed 2007: Day 3


November 7, 2007 - 18:18, by Steven Van de Craen - 0 Comments

Develop a Community Solution with VSTO 3.0, Office Open XML and WSS 3.0

Mario Szpuszta builds a restaurant rating web solution from scratch.

Restaurant owners can submit their restaurant details in the form of a Word 2007 document containing Content Controls mapped to a custom XML part. A custom Web Service returns the submitted restaurants from the SharePoint List and is used in a custom VSTO 3.0 Task Pane to generate invites from inside Word 2007.

This session is a good example of the ease of creating a rich solution for bringing back-end data to the Office clients.

Best Practices for Developing, Deploying and Maintaining SharePoint Solutions (Q&A)

A decent session with real life problems and questions from the SharePoint community here at TechEd Developers 2007. We discussed SharePoint as a development platform -which it definitely is, although at present the developer experience is rather painful, how to do development (VPC versus Native), what to expect from SharePoint as a developer, etc.

Both Ted Pattison as Patrick Tisseghem provided the best possible feedback and solutions to the endless stream of questions from the audience.

FYI, my personal preference is doing VPC development because this way I can quickly switch between various projects and SharePoint versions while keeping all client solutions separated.

Developing Secure Solutions in Microsoft SharePoint Products and Technologies 2007

Another session from Ted Pattison discussing some interesting implementations and consequences of security in SharePoint. We got to see code to set custom permissions for sites, lists and items using the Object Model, how to perform Elevation of Privileges and User Impersonationn, and setting Policies for Web Applications.

Hidden Gems in ASP.NET 2.0

Stefan Schackow, one of the Product Managers on ASP.NET at Microsoft, shows a selection of cool ASP.NET 2.0 features such as Asynchronous Page Callbacks, Expression Builders, Virtual Path Providers, Post-Cache Substitution and more.

Other

Tonight is the Belgian & Luxemburg Country Drink. Let's just hope they have Belgian beers too ;-)

 

Day 1: 5th November 2007
Day 2: 6th November 2007
Day 3: 7th November 2007


MOSS 2007: Exception when handling a document renaming event


November 7, 2007 - 14:07, by Steven Van de Craen - 3 Comments

Situation

I have written a small Event Handler to automatically copy the file name and version to custom text fields in order to be able to use them in Microsoft Word.

  • ItemAdded
  • ItemCheckedOut
  • ItemUpdated

Here's a small sample of the code I'm using:

public override void ItemUpdated(SPItemEventProperties properties)
{
    
SPListItem item = properties.ListItem;
     CopyMetadata(
ref item, "ItemVersion", item.Versions[0].VersionLabel);
     ...

     item.SystemUpdate(
false);
}

Problem

This code runs flawless as long as I don't change the file name. Changing the file name throws the following exception:

There is no file with URL 'Workinstructions/Test.doc' in this Web.

StackTrace:
   at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)
   at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents)
   at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)
   at Microsoft.SharePoint.SPListItem.SystemUpdate(Boolean incrementListItemVersion)

Cause

When using the SPListItem instance from properties.ListItem it seems that this instance is invalid at some times. Trying to work with this instance throws the exception.

I have only been able to reproduce this issue when Variations (MOSS Publishing Feature) are enabled on the Site Collection.

Solution

You will probably be frowning when looking upon this code but it does bypass the above issue. Basically I'm pausing the thread until I can get the item after the rename by checking the AfterUrl. To avoid an endless loop I limit the number of tries to 100.

/// <summary>
///
Get the ListItem by opening a new SPWeb and using SPList.GetItemById.
/// Wait for the rename to have finished before returning the item.
/// </summary>
///
<param name="properties"></param>
///
<returns>Item</returns>
///
<remarks>
///
This issue occurs mostly when the following conditions are met:
/// - Variations are enabled and the SPList resides in a SPWeb in the Variation Hierarchy
/// - The item is renamed
/// - SPListItem.SystemUpdate(), SPListItem.UpdateOverwriteVersion() is called in the ItemUpdated Event Handler
/// </remarks>
private SPListItem GetRenamedListItem(ref SPItemEventProperties properties)
{
     SPListItem result =
null;
     for (int i = 0; i < 100; i++)
     {
          result = properties.OpenWeb().Lists[properties.ListId].GetItemById(properties.ListItemId);

         
if (result.Url.Equals(properties.AfterUrl))
               break;

         
Thread
.Sleep(100);
     }

     return
result;
}

In every event method I'm overriding I just use this method to retrieve the item reference.

Applies To

MOSS 2007 (I have only experienced this issue when Variations were enabled on the Site Collection)


 Next >>