Monday, July 21, 2008

Funny video for developers

Stupid sales people should learn how to use the software they are selling. I can't tell you how many times I had to help people learn about the MS software that they had no idea how to use but were trying to sell it to our clients.

http://www.thewebsiteisdown.com/

InfoPath Rules vs Code

When writing custom code behind for an InfoPath form you should keep in mind that when used on a button with other rules that the rules will run before the code. This means that if one of your rules "Closes the form" that your code will have to do this instead, otherwise the rule will close the form and your code will never run.

There is no way to switch the OoE or Order of Execution within InfoPath. Here is a sample to close the form in code in a js script code behind. There is also no need to sign the form unless the code interacts with the SharePoint OM.

Application.XDocuments.Close(0); //will close form but keep InfoPath open

Application.Quit(bool) //will exit InfoPath and if true force an exit, if false will prompt user if they want to save the form

I used true because in a rule I submit the form so the code can go ahead and quit InfoPath.

Tuesday, July 15, 2008

Installation Instructions for Sitecore CMS 6

Sitecore has not provided a migration path from v5.3 to v6 and therefore a lot of Sitecore users cannot upgrade to the latest and greatest. I think this is unacceptable.

Here are screenshots of the Sitecore 6 installation process in case you ever get there.

Sitecore 6 Installation Screenshots

Programmatically create folder within SharePoint List

So simple yet somewhat not obvious.

SPList list = {some SPList object}
SPListItem folder = list.Items.Add(string.empty, SPFileSystemObjectType.Folder, "Name of folder to create");

Monday, July 14, 2008

Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)

This error:

Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)


Most likely indicatest that your SQL Server is not enabled for Mixed Mode authentication, it is probably only allowing Windows logons to log onto it, make it mixed mode and then you'll be able to connect using your SQL server login account. Quick fix but unknown unless you have this information.

Friday, July 11, 2008

Import SharePoint v3 sites using stsadm -o import, replacement for smigrate

So now that you've successfully exported a WSS v3 site we need to figure out how you can import it into another WSS site or into a WSS site sitting underneath your MOSS 2007 site. Again, the export gives us some functionality that smigrate did not, mainly the ability to import user security from our exported file. Here is the command line instructions:

stsadm.exe -o import -url

-filename

-includeusersecurity

-haltonwarning

-haltonfatalerror -updateversions <1-4>

1 - Add new versions to the current file

2 - Overwrite the file and all its versions

3 - Ignore the file

4 - Terminate with conflicts

-quiet

And here is an example:

stsadm.exe -o import -url http://officepoint.blogspot.com/SiteDirectory/NewlyImportedSite -filename C:\backups\officepoint.blogspot.com.bak -includeusersecurity -haltonfatalerror -updateversions 1

This will import my backup file named officepoint.blogspot.com.bak to the site named NewlyImportedSite that sites beneath my MOSS site, it will, of course, include all of the user security from the exported site, it will stop importing if it encounters a fatal error and will update the versions of the site instead of deleting them and replacing them.

WSS (SharePoint) v3 stsadm.exe -o export, replacement for smigrate

We all know that WSS v2 lacked the ability to migrate sites and include the user security in that migration. You could use smigrate to move a site but you would lose all of the users and the user security during the process. Well in SharePoint version 3 Microsoft has developed this ability. It is now possible to backup a WSS site using stsadm and restore it, with all security in tact, to another WSS instance or as I found out even to a WSS site underneath MOSS 2007. This is how you perform the export of your site and include the security.

stsadm.exe -o export -url
-filename
-overwrite
-includeusersecurity
-haltonwarning
-haltonfatalerror
-versions <1-4>
1 - Last major version for files and list items
2 - The current version, either the last major or the last minor
3 - Last major and last minor version for files and list items
4 - All versions for files and list items
-cabsize
-quiet

So an example of this would be:

stsadm.exe -o export -url http://officepoint.blogspot.com -filename C:\backups\officepoint.blogspot.com.bak -overwrite -includeusersecurity -haltonfatalerror -versions 2 -quiet

This will export the WSS located at http://officepoint.blogspot.com to a file named officepoint.blogspot.com.bak in the backups folder on my C: drive. It will overwrite any backup files already there. It will include all of the user security of the site. It will stop the export if it hits a fatal error, it will perform a quiet export and export the current version of the site.

It takes a little longer to run because of all the extra web parts and lists created with WSS v3, but it'd definitely nice to have this ability. The only question I can think of is, if I copy the stsadm executable to a WSS v2 site, will it export v2 sites with their security or is this functionality only limited to version 3?