So, curious about how my Sharepoint adventure is coming along? It is all that I have been doing all week. Very unusual for me, who usually flits around from one project to another.
I'd say it's going pretty well (and I had some great feedback when I showed my client today), though there was definitely some hairpulling through the week. Good thing I have lots of hair! Probably my biggest struggle was with the admin stuff - setting up Sharepoint properly on my web server. There was never any such thing as “properly“ happening here! I installed and uninstalled it about ten times. (If you have followed my blog in the past, I have always been clear on the fact that I am NOT a sysadmin!) Luckily this is my own home office test server, so no public bytes were harmed in the process. To top it off, thanks to my badly done installation (which managed to work for me anyway) the Windows Server update knocked down my house of cards and I found myself with "Service Unavailable" as the result of any attempt to browse to sites on that web server. After hours of advice from many very knowledgeable folks, I finally gave in and uninstalled not only sharepoint, but IIS too, then reinstalled both and all seems to be okay (for now).
Once I got past that, it was back to tangling with the sharepoint APIs, web services and database. I have actually put together a very simplified solution for my client (which is just proof of concept so far) but it is one that requires no navigation on the part of the users. One page will list all of the docs that they have access to, which for this scenario of few docs per person, is a-ok. Plus I have built in total control over checking in and checking out which we like much better than what is available in the default WSS UI. It won't be possible for someone to edit and save a file on the site without checking it out first.
A few of the interesting lessons learned (though they are certainly not new, just new to me) are these:
- SessionState is turned off in Sharepoint. It is possible to turn it on, but you probably don't want to. I liked this post that explains why. Instead, leverage some of the other ways of moving data around. For example, to get data from one web page to another, I have always been a fan of the code-behind method explained on this page.
- If you are trying to programmatically change data on the site, you might get Security Validation errors. The trick here is that you need to embed the Sharepoint FormDigest control on the page. This is done by first registering the namespace in the html (where the page directives go) with this:
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
and then putting the control inside the body tags (I put it inside the form tag):
<form.....>
<SharePoint:FormDigest runat="server"/>
</form>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
Then, I was able to turn security validation back on on my site and ignore the many suggestions I found via Google to set AllowSafeUploads on during the session. There was a lot more of course, but some problems remain unsolved and I'd rather share the solution than my dreadful unextensible and very temporary workaround! Definitely some of the problems are elusive.