Sunday, June 14, 2009

HTML Viewer and MOSS 2007

Some of you already know that SharePoint 2003 (and WSS v2) provide a functionnality which convert Office document on HTML page for client which has not Office installed.
This function is called HTML Viewer and need to be downloaded as an add-on.
Now, if you check on MOSS/WSS v3, you still have the capablity to manage this function (like in SPS 2003). However, the download for HTML Viewer currently available DOESN'T WORK with MOSS/WSS v3.
Mainly, this is due to some security issue found after the realease and for some other part for the new code used by MOSS.
Actually, the product group doesn't plan to release a newer version of HTML Viewer which can works with MOSS. Seamily, due to a very low usage (counted thanks to the number of download for HTML Viewer) of HTML Viewer in SPS 2003.
So, if you plan to use this functionnality, you have to wait for third party or news for the product group.

Monday, March 30, 2009

Implement the Object Model in a Custom Web Part

How to: Implement the Object Model in a Custom Web Part

http://msdn.microsoft.com/en-us/library/ms479215.aspx

Working with List Objects and Collections

http://msdn.microsoft.com/en-us/library/ms460897.aspx

ERROR

The "SimpleWebPart" Web Part appears to be causing a problem. Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb

SOLUTION

SPWeb myweb2 = SPControl.GetContextWeb(Context);

myweb2.AllowUnsafeUpdates = true;


ERROR

Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security

SOLUTION

<trust level="Full" originUrl="" />

To get the PublicKeyToken

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin>

sn -T *.dll

Where to Put Webparts

C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin

The web.config you have to edit to add safeControls

MOSS 2007 Theme

MOSS 2007 Theme

- Copy
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES\GRANITE folder

--- Theme.inf Title and theme information
--- Theme.css
--- Images

- Rename GRANITE.INF with ANYTHING_THEME.INF
Open the file and replace every GRANITE word with ANYTHING_THEME

- Open this file with notepad
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML

- Add this entry:

ANYTHING_THEME

ANYTHING_THEME

ANYTHING_THEME bla bla bla.

images/thANYTHING_THEME.gif

images/thANYTHING_THEME.gif

MOSS 2007 Export/Import

MOSS 2007 Export/Import

- This task can be done only locally on the server machine.
- Use the user that been used for installing MOSS.
- Open the command line.
- Go to this location:
\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\

Export command:
stsadm.exe -o export -url http://SERVER_NAME -filename c:\FILE_NAME.bak -overwrite

Import Command:
stsadm.exe –o import –url http://URL –filename c:\FILE_NAME.bak

NOTE:
If you got this error: Object reference not set to an instance of an object.
You are not the administrator, login using the user that been used to install MOSS

The two sites should be the same, make sure that they have the same features. Ex: Publishing site can't be imported to team Site.

NHibernate and Sharepoint 2007

NHibernate and Sharepoint 2007

Sharepoint webpart that uses NHibernate to do Database operations.
It was a hard task, spent 2 days fixing deployment errors and assemblies dependencies.

At the end it worked :)

Make sure:
- Hibernate mapping file build action is embedded resource
- Use NHibernate.ByteCode.Castle not NHibernate.ByteCode.LinFu (I donno why!)
- hibernate.cfg.xml and NHibernate.ByteCode.Castle.dll should be in C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin
- NHibernate required libraries put them in the GAC C:\WINDOWS\assembly