Tuesday, November 15, 2011

Requirements for SharePoint Groups when sending emails to them

I had a SharePoint designer workflow that send an email to a SharePoint group. In the History Log of the workflow, the follow message was logged:
The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.
The outgoing email settings however were configure correctly (alerts and emails from other workflows were being send out).
There were actually two reasons why the emails weren’t being sent:
The settings ‘Who can view the membership of the group?’ on the group was configured as ‘Group Members’
The workflow is executed in the context of the current user. If the user has no access to view group membership, the workflow won’t be able to expand the group.
You should configure this settings as ‘Everyone’
image
The group had no permissions
The group should have at least ‘Read’ permission to the site. If the group has no permissions configured, you will receive the error as described above.
image

Wednesday, November 9, 2011

Configure hMailServer for SharePoint

Nice article from Wesley Bakker on how to use hMailServer for SharePoint: http://weblogs.asp.net/wesleybakker/archive/2010/08/09/configure-hmailserver-for-sharepoint.aspx

In Short:
Authentication
SharePoint cannot authenticate to an SMTP server, so you need to disable authenctiaction on the hMailServer (at least for the local computer)
  • In Settings / advanced / IP Ranges add an IP range (either the ip of the server or simply 0.0.0.0 - 255.255.255.255) and disable 'Require SMTP authentication'.
Drop folder
If you're not using the build-in SMTP service, you need to configure SharePoint incoming mail to use a dropfolder. Also, SharePoint relies on the x-sender and x-receiver headers to process the mail. hMailServer does not add these messages, so these need to be added
  • Create a [dropfolder] and make sure the SharePoint Timer Service has read/write/modify access to it.
  • Configure hMailServer's scripts (Settings / Advanced / Scripts) to handle the OnDeliverMessage event.
  • Use the following script
  • Sub OnDeliverMessage(oMessage)
        Dim path, filename, fso, original, copy
        path = Split(oMessage.Filename, "\", -1, 1)
        filename = "[dropfolder]" & path(UBound(path))
        Set fso = CreateObject("Scripting.FileSystemObject")
        Set copy = fso.CreateTextFile(filename, True)
        copy.WriteLine("x-sender: " & oMessage.FromAddress)
        copy.WriteLine("x-receiver: " & oMessage.To)
        Set original = fso.OpenTextFile(oMessage.Filename, 1)
        copy.WriteLine(original.ReadAll)
        copy.Close
        original.Close
    End Sub
  • Configure SharePoint incoming mails to point to the [dropfolder]
  • Optionally configure hMailServer with a catch-all address (Domains / <domain> / Advanced tab) so you don't have to create an account for each Email Enabled library you use in SharePoint.
The script will copy ALL emails to the dropfolder. Emails that are not intended for SharePoint will simple be ignored by SharePoint.

Tuesday, October 25, 2011

Content By Query WebPart outputs incorrect url when there is no root sitecollection

If you have a webapplication with no sitecollection at the root url (e.g. all site collection are located under http://<webapp>/sites/…) and you use the CBQWP to query for list items (events / tasks./ … anything but documents), you will receive a ‘404 page not found’ when clicking the link.

The CBQWP uses the CopyUtil.aspx page to redirect you to the item in question (see http://weblogs.asp.net/jan/archive/2008/02/26/copyutil-aspx-a-little-sharepoint-gem.aspx). If there is no sitecollection at the root url, the site collection url will be missing from the url that is generated.

To solve this issue, edit the ‘ContentQueryMain.xslt’ file and change

<xsl:if test="$UseCopyUtil = 'True'">
<xsl:value-of select="concat('/_layouts/CopyUtil.aspx?Use=id&Action=dispform&ItemId=',@ID,'&ListId=',@ListId,'&WebId=',@WebId,'&SiteId=',$SiteId)"/>
</xsl:if>

into

<xsl:if test="$UseCopyUtil = 'True'">
<xsl:value-of select="concat($SiteUrl,'/_layouts/CopyUtil.aspx?Use=id&Action=dispform&ItemId=',@ID,'&ListId=',@ListId,'&WebId=',@WebId,'&SiteId=',$SiteId)"/>
</xsl:if>

Tuesday, October 18, 2011

SQL Server 2005 ‘Login failed’ (error 18456 state 16)

The event log of one of our SQL Servers filled up with events 18456 (every minute).

Failure Audit: Login failed for user '<DOMAIN>\<username>’. [CLIENT: <local machine>]

Looking in the SQL Server log, I found some extra information.

2011-10-18 12:52:00.55 Logon       Error: 18456, Severity: 14, State: 16.

I found this MSDN blog post, explaining most of the State codes, except for state 16.

ERROR STATE

ERROR DESCRIPTION

2 and 5

Invalid userid

6

Attempt to use a Windows login name with SQL Authentication

7

Login disabled and password mismatch

8

Password mismatch

9

Invalid password

11 and 12

Valid login but server access failure

13

SQL Server service paused

18

Change password required

 
Digging a little further, I found that State 16 usually means that the target database cannot be located. I most cases, this is due to an SQL Server Job that targets a deleted of offline database.
 
Deleting or disabling the job gets rid of the errors in the event log.

Tuesday, October 4, 2011

Update Mango Beta 2 to RTM without restoring to NODO

Apparently, it's possible to update your Windows 7 phone with the Mango Beta 2 installed to the RTM version of Mango without having to restore the NODO backup (and loosing all you have done since). Just update Zune to version 4.8, connect your phone and you will receive 2 updates. see http://forums.create.msdn.com/forums/t/92311.aspx

Monday, September 19, 2011

SharePoint 2007 workflow activities disabled in Visual Studio 2010 toolbox

Just noticed that when I tried to create a SharePoint 2007 workflow in Visual Studio 2010, the ‘SharePoint Workflow’ toolbox tab was missing. Selecting ‘Show all’ learned me that is was loaded, but they were all disabled.
As it turned out (after comparing the project file with another one where the toolbox was available) I was mssing a ProjectTypeGuid ({F8810EC1-6754-47FC-A15F-DFABD2E3FA90}) in my .csproj file
image

EDIT: a list of know ProjectTypeGuids can be found here: http://www.mztools.com/articles/2008/MZ2008017.aspx

Friday, September 16, 2011

caml.net.intellisense - Making SharePoint development a little easier

Just stumbled upon this nice little tool in the Visual Studio Gallery. It extends the default SharePoint 2010 intellisense schema in Visual Studio 2010 by adding xs:annotations elements and replacing xs:string types with enumerated types.
Download here: http://visualstudiogallery.msdn.microsoft.com/15055544-fda0-42db-a603-6dc32ed26fde
The result:
ListTemplateTypeEnum
Editing a FieldRef Element

Thursday, September 15, 2011

Windows Search and Xml files

When you try to use Windows Search on the contents of xml files, you will find that not all text of an xml file is indexed.

For example, if you have the following xml file:
<myelement attrib="myattrib">
myelementtext
</myelement>
You will be able to find it by searching for “myelementext”, but searching on any of the terms below will fail
  • <myelement
  • "<myelement"
  • \<myelement
  • "\<myelement"
  • %myelement
  • ?myelement
  • [<]myelement
  • xpath:\\myelement
Apparently, you can only search over the prefix of the term (ex: "test*"). With that said, the XML filter only outputs text terms within the XML document. (in our example only the terms myattrib and myelement are indexed). The other elements are attributes that are not typically user facing.

To have all text in an XML file indexed, we need to assign XML extension to use the plain text filter.
This is (currently) not possible with the UI, so you will need to modify the registry.

Navigate to HKEY_CLASSES_ROOT\.xml\PersistentHandler and change the default value to {5e941d80-bf96-11cd-b579-08002b30bfeb}

You will have to rebuild the index (Control Panel / Indexing options / Advanced / Rebuild)  to re-index the xml files.

Copy the lines below into a file with a .reg extension and double click to update the registry for you.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.xml\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
To verify that the 'plain text filter' is being used, go to 'Control Panel', 'Indexing Option'. Select Advanced and on the 'File Types' tab, verify that the 'Plain Text Filter' is being used for the 'xml ' extension


Note that you can also have other files (xsl, xslt, xsd, ...) using the plain text filter by modifying the associated registry key

e.g. for xslt
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.xslt\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
For info on how to enable windows search in Windows Server 2008 (R2) see: http://blog.sdbonline.com/2012/02/update-windows-search-and-xml-files-on.html

Thursday, September 8, 2011

‘no connection’ when trying to view another user’s calendar – free/busy information (exchange 2010)

A while ago, the company I currently work for updated their servers to Exchange 2010. Ever since, I was unable to view other people’s calendar and free/busy information. The only error I got was a 'no connection’ message in the calendar tab.

I was using Outlook 2010 on a computer that was NOT part of the domain.

When searching the internet, I noticed that I wasn’t the only one suffering from this behavior, but I couldn’t find an answer for the problem.

I turned on logging in Outlook (File – Options – Advanced – Enable troubleshooting logging) and found that the log file (%temp%\olkdisc.log) was filled with error from the Autodiscover service)

image

This led me to this Outlook 2007 article on TechNet which explains the relationship between the Autodiscover service and the Availability service:

The Availability service for Microsoft Exchange Server 2007 provides calendar information for your users. This information is known as free/busy information. The Autodiscover service provides information for the Availability service by locating and providing the external and internal URLs for the Outlook 2007 client. If your Microsoft Office Outlook 2007 users cannot view calendar information for other Outlook 2007 users in your Exchange 2007 environment, the problem may involve a failure in either the Autodiscover service or the Availability service.

The article provides the following steps to test the Autodiscover service (the article is for Outlook 2007, but the steps are the same for Outlook 2010):

    1. While Outlook 2007 is running, hold down the CTRL key, right-click the Outlook icon in the notification area, and then select Test E-mail AutoConfiguration.
    2. Verify that the correct e-mail address is in the box next to E-mail Address.
    3. Clear the check boxes next to Use Guessmart and Secure Guessmart Authentication.
    4. On the Test E-mail AutoConfiguration page, verify that the check box next to Use AutoDiscover is selected, and then click the Test button.

I my case, the test failed because of the Autodiscover services could not be reached.

As it turned out, the Proxy server could not reach the Autodiscover service. I used Internet Explorer to add the url to the ‘Local Intranet’ zone, so the proxy server would be bypassed and everything worked perfectly.

Thursday, August 25, 2011

Reflector Alternatives

Now that reflector is no longer a free tool (see http://www.reflector.net/2011/04/why-we-reversed-some-of-our-reflector-decision/), alternatives are gaining popularity.

2 promising alternatives are ILSpy (http://wiki.sharpdevelop.net/ILSpy.ashx), an open source initiative that initiated after the announcement by Red-Gate, and dotPeek (http://www.jetbrains.com/decompiler/) a free tool by JetBrains, the same people that brought us ReShaper.

Wednesday, June 1, 2011

IE8 Developer tools opening automatically when opening new tab

Got an annoying issue today. Whenever I opened a new tab in Internet Explorer (IE8), a new instance of the 'Developer tools' would open automatically. Normally, when you close them, they shouldn't reopen again until you explicitly want to.

The result was after opening 6 or 7 tabs, there would also be 6 or 7 instances of the developer tools.

I tried turning the off and closing IE, even rebooting, but they would keep 'popping' up.

Eventually, I managed to get rid of them by doing the following

1. Open the registry editor
2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools
3. Set the value of the key 'Pinned' to '1' (REG_DWORD)
4. Open IE - this loaded the developer tools to, but they were pinned (embedded) in the browser window
5. close the developer tools while embedded

This FINALLY prevented the developer tools from being loaded with every tab I openened.

meh :/

Tuesday, April 5, 2011

Forcing your Windows Phone 7 to update

Microsoft recently release the 'March 2011' (aka NoDo) phone update. Unfortunately, not all phones are updated at the same time. An update schedule has been posted here: http://www.microsoft.com/windowsphone/en-us/features/update-schedule-world.aspx

If your phone is listed under 'Delivering update', you can 'trick' the Zune software & your phone to get the update anyways.

1. Start Zune on Your PC
2. Turn off Data connection ( Setting >System > Mobile Network > Data Connection ) and Wifi ( Setting >System > WiFi ) on the Phone
3. Connect the Phone with the PC (via USB)
4. Start the update search in Zune ( Settings > Phone > Update )
5. About 3 seconds later, disconnect your PC from the internet (Turn WLAN off)
6. Zune finds NoDo-Update. Press OK
7. Connect to the internet again on your PC and install the update

Worked like a charm for my phone (HTC Throphy)

The full story here & here