Wednesday, July 18, 2007

Mail Merge and Microsoft Office SharePoint Server 2007

In Word 2007 you have the possibility to merge a document template with data from a data source, creating for example a mailing very easily. The data source can be various types of documents, like Excel, Word or Access files. But it turns out that Word 2007 cannot handle data source documents on an http location.

When opening a mail merge template document and you try to connect a source document which is located on a SharePoint site (Mailings > Select Recipients > Use Existing Lists > My Network Places > Select document on SharePoint site), Word 2007 gives the error message “This file could not be found”. A workaround is to download the source document to the local computer (for example the desktop) and connect it there. The downside is that you have to download the document each time you want to do a mail merge.

Hopefully this issue will be fixed in the next Office Service Pack.

Monday, July 16, 2007

[MOSS2007] The inner workings of the MySite functionality in MOSS2007

In SharePoint 2007 users have the possibility to create a personal site called MySite. This site can be used to store and share documents and other data (contacts list, calendar, etc). A MySite has two parts, a personal and a public part. On the personal part of the MySite, users can edit their details, add colleagues, upload and share documents, etc. The public part is available for other users. Here the details of the user are shown and the users can access the shared documents.

The personal part of a MySite is a site collection in a web application. When accessing you personal part for the first time, a site collection is created in the web application which you configured during the configuration of the Shared Services Provider (SSP).

During this SSP configuration, the config wizard also creates a MySite Host. This is a site which redirects you to your very own MySite when you try to access it. It also provides the public part of the MySite and other generic MySite pages.

Why am I talking about this MySite Host?? Because that MySite Host determines in which language parts of you MySite are shown. When creating a MySite (with multiple language packs installed) you are asked in which language you want your MySite to be created. But this is only the private part (the site collection).

On an environment I installed recently, I had installed and configured MOSS2007. After I created a SSP (sharedservices.) and MySite WebApp (mysite.), configured the SSP and created a site collection WebApp (portal.). Then I installed the Dutch language pack and created the first site collection based on the dutch Collaboration Portal template.

During testing of the portal I ran into some issues with some parts of the MySite being in Dutch and some parts being in English. After some testing I found out about the MySite Host (root of the mysite. webapp). Because the language pack hadn’t been installed while configuring the SSP, the MySite host had been installed using the English template. To solve this issue I deleted the MySite Host site collection and recreated the site collection, using the Dutch template and voila….all of the MySite is in Dutch!!

So if you are using language packs for MOSS2007 and notice that some parts of the MySite are in English instead of the language of your language pack, just delete the MySite Host site and recreate it using the localized version of the MySite Host template (can be found under the Enterprise tab).

Friday, July 13, 2007

[MOSS2007] Issues with web part toolbars and audiences/Active Directory groups

Over the past few days I ran into some small but very annoying issues with SharePoint 2007:

The first is with a document library web part. After placing a document library web part on a page and configuring it with a “Full Toolbar”, I wanted to change some fields which are shown in the web part. I opened the “Modify This Web part” menu, clicked “Edit current view”, made some changes and clicked Ok. When the web part page was shown, the Full Toolbar had switched back to the Summary Toolbar. Also the “Modify This Web part” sidebar was closed. It meant I had to open the sidebar again and configure the Full Toolbar again. Very annoying behavior!

The second issue is when you are using Active Directory groups in audiences. In SharePoint 2003, using audiences meant creating special audiences which are compiled according to predefined rules. As of SharePoint 2007 it is possible to use AD groups directly as an audience. When a user is a member of that group, the item or web part is shown to the user.
On a page I had several web part configured with AD group audiences. In the AD I moved the groups to a different OU and after a profile import my web parts weren’t shown to anyone any more. Some troubleshooting revealed that the groups were in the profile list twice, one for the old OU and one for the new OU. Because they had exactly the same name, I could not determine which group was the correct one. I added both groups to the web part audience to get it working again.
Looks like SharePoint is looking at the absolute DN when using AD groups in audiences. Now I am hoping the “old” groups will disappear automatically……not really sure.

Tuesday, July 03, 2007

Add SharePoint sites to "My Network Places"

When browsing SharePoint sites, Windows sometimes adds these sites to the "My Network Places" on your XP box. This enables you to easily save documents right from Word for example into SharePoint. Unfortunatelly I have noticed that Windows XP not always adds SharePoint sites to the My Network Places automatically.

On a forum I found a solution for this issue. A guy named DonQ created a vbs script which I used in my logon script. Depending on group memberships, SharePoint sites are automatically created for the users while logging in.

The script I used as a starting point is:
'Create Network Folder
'This is a fix to the original, which I found did not handle URLs
'longer than 44 characters.

Option Explicit

Sub CreateNetworkFolder(siteURL, siteName)

Dim iRes, jRes, MT, TT
Dim SH, newPath
Dim objFso, f, fs, g

Dim bString
Dim ltrIndex
Dim nameLength, urlLength, urlCutoff
Dim aFile

'ForWriting (2) is the attribute to be set when writing to a file.
Const ForWriting = 2

nameLength = Len(siteName)
urlLength = Len(siteURL)
'44 seems to be the length where we have to change a 00 to a 01.
urlCutoff = 44

MT = "OK to create a My Network Places " & vbCr & "folder for " & siteURL & vbCr & "named " & siteName & "?"
TT = "My Network Places"
iRes = MsgBox(MT, vbOKCancel + vbInformation, TT )

Set objFso = CreateObject("Scripting.FileSystemObject")

If iRes = vbCancel Then
WScript.Quit
End If

Set SH = WScript.CreateObject("WScript.Shell")

'Create the folder under NetHood that will hold the target.lnk file
newPath = SH.SpecialFolders("NetHood") & "\" & siteName

If (objFso.FolderExists(newPath)) Then
WScript.Echo "A Network Place with that name already exists."
WScript.Quit
End If

objFso.CreateFolder(newPath)

'We ceate a Desktop.ini file
Set fs = CreateObject("Scripting.FileSystemObject")
aFile = newPath & "\Desktop.ini"

Set f = fs.OpenTextFile( aFile, ForWriting, True )

'Write the data lines that will make this a folder shortcut.
f.WriteLine "[.ShellClassInfo]"
f.WriteLine "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}"
f.WriteLine "Flags=2"
f.WriteLine "ConfirmFileOp=0"
f.Close

'We make Desktop.ini a system-hidden file by assigning it attribute of 6
Set fs = CreateObject("Scripting.FileSystemObject")
Set g = fs.GetFile(newPath & "\Desktop.ini")
g.Attributes = 6

'We make the folder read-only by assigning it 1.
Set fs = CreateObject("Scripting.FileSystemObject")
Set g = fs.GetFolder(newPath)
g.Attributes = 1

'This is where we construct the target.lnk file byte by byte. Most of the lines are shown in 16 byte chunks,
'mostly because that is the way I saw it in the Debug utility I was using to inspect shortcut files.

'Line 1, 16 bytes
bString = Chr(&H4C) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H01) & Chr(&H14) & Chr(&H02) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&HC0) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'Line 2, 16 bytes
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H46) & Chr(&H81) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'Line 3, 16 bytes
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'Line 4., 16 bytes. 13th byte is significant.
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H01) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'Line 5. 13th byte is significant.
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'When I was analyzing the next byte of shortcuts I created, I found that it is set to various values,
'and I have no idea what they are referring to. In desperation I tried substituting some values.
'00 caused a crash of Explorer. FF seeems to work fine for all.
'If anyone can get back to me on what this byte is or why FF works, please contact me.
bString = bString & Chr(&HFF)

'This byte is 00 if the URL is 44 characters or less, 01 if greater.
If urlLength > urlCutoff Then
bString = bString & Chr(&H01)
Else
bString = bString & Chr(&H00)
End If

bString = bString & Chr(&H14) & Chr(&H00)

'Line 6, 16 bytes
bString = bString & Chr(&H1F) & Chr(&H50) & Chr(&HE0) & Chr(&H4F) & Chr(&HD0) & Chr(&H20) & Chr(&HEA) & Chr(&H3A) & Chr(&H69) & Chr(&H10) & Chr(&HA2) & Chr(&HD8) & Chr(&H08) & Chr(&H00) & Chr(&H2B) & Chr(&H30)

'Line 7, 16 bytes
bString = bString & Chr(&H30) & Chr(&H9D) & Chr(&H14) & Chr(&H00) & Chr(&H2E) & Chr(&H00) & Chr(&H00) & Chr(&HDF) & Chr(&HEA) & Chr(&HBD) & Chr(&H65) & Chr(&HC2) & Chr(&HD0) & Chr(&H11) & Chr(&HBC) & Chr(&HED)

'Line 8, 16 bytes
bString = bString & Chr(&H00) & Chr(&HA0) & Chr(&HC9) & Chr(&H0A) & Chr(&HB5) & Chr(&H0F) & Chr(&HA4)

'This byte is 00 if the URL is 44 characters or less, 01 if greater.
If urlLength > urlCutoff Then
bString = bString & Chr(&H01)
Else
bString = bString & Chr(&H00)
End If

bString = bString & Chr(&H4C) & Chr(&H50) & Chr(&H00) & Chr(&H01) & Chr(&H42) & Chr(&H57) & Chr(&H00) & Chr(&H00)

'Line 9, 16 bytes
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H10) & Chr(&H00)

'Line 10, 2 bytes
bString = bString & Chr(&H00) & Chr(&H00)

'The next byte represents the length of the site name.
bString = bString & Chr(nameLength)

'Take the site name, and write each letter, preceeded by a "00" character.

For ltrIndex = 1 to nameLength
bString = bString & Chr(&H00) & Mid(siteName, ltrIndex, 1)
Next

'Middle line, separates the Folder Name from the URL. 3 bytes.
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00)

'The next byte represents the length of the site URL.
bString = bString & Chr(urlLength)

'Take the site URL, and write each letter, preceeded by a "00" character.
For ltrIndex = 1 to urlLength
bString = bString & Chr(&H00) & Mid(siteURL, ltrIndex, 1)
Next

'Last line, 13 bytes
bString = bString & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00) & Chr(&H00)

'Let's create the target.lnk file.
Set fs = CreateObject("Scripting.FileSystemObject")
aFile = newPath & "\target.lnk"
'aFile = newPath & "\vb.sss"
Set f = fs.OpenTextFile(aFile, ForWriting, True)
f.Write bString
f.Close

MT = siteName & " created."
jRes = MsgBox(MT, vbOK, TT )

End Sub

CreateNetworkFolder "http://ReallyReallyLongURL.com/big_long_subfolder/", "Really, Really Long"

Source:
http://totheescrime.org/FolderShortcut/fs.txt

http://www.codecomments.com/archive300-2005-4-452832.html

Monday, July 02, 2007

Deploying MOSS in an DMZ configuration

When planning to deploy MOSS as an Internet solution, the question "can I place the database server in my internal network, instead of the DMZ" is often asked. During some wondering around the Microsoft site I ran into the following article: Plan security hardening for extranet environments:
"This article details the hardening requirements for an extranet environment in which a Microsoft Office SharePoint Server 2007 server farm is placed inside a perimeter network and content is available from the Internet or from the corporate network"

Very usefull information, but the thing I found extremely usefull was the link to the "Extranet hardening planning tool: back-to-back perimeter" This is a Visio drawing which explains which ports need to be opened when deploying components inside or outside firewalls, etc. Take your advantage of it!!!