Posts

Showing posts from 2009

Error adding solution to MOSS

The issue is that when you do stsadm -0 addsolution -filename "solution.wsp", you get an error message that says "Object reference not set to an instance of an object." even tho you're a SharePoint farm administrator. To solve this problem, you need to make sure Your account is in WSS_Restricted_WPG group Your account has access to SharePoint Central Admin Content database and config database. To find out your Central admin content database, Go to Central Administration site Application Management Content Databases Select the Central Administration Web Application. The content database for Central Administration will be displayed.

MOSS Workflow History Association

Based on a lot of the blog sites, SharePoint 2007 (MOSS) has a timer job that will purge the workflow history association with the work item after 60 days. For most of the users, this is not a good thing because our their audit depends on it. I have read a few solutions that can work around this issue. Use a custom list for audit and do not depend on the workflow hisory. Based on Microsoft, workflow history is not intended for audit purposes. You should probably always create a separate audit log. You can write code to log your workflow history or events to a separate list. Try to use folder structure (i.e. year, month, workflow ID, etc...) so that you don't have more than 2000 items in a view/folder. Write code to change the default days from 60 to whatever your requirement is. There is a sample code that was posted on one of the comments in this post(http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/b15b27e2-3033-418b-9731-968273d7423e). I have copied and pa...

Close/Open Web Parts Programmatically

I didn't see a lot of post that shows you how to close and open web parts programmatically. I figured I'll writer one just in case I forget how to do it later. You have to work with WebPartManager class for working with web parts. To get the web part manager, you can do the following: SPFile page = site.GetFile("pageUrl") SPLimitedWebPartManager webPartMngr = page.getLimitedWebPartManager(PersonalizationScope.Shared); Once you have the WebPartManager, you can get the web part that you want to close by doing: Foreach (WebPart webPart in webPartMngr.WebParts) { if (webPart.Title == "testWebPart") { webPartMngr.CloseWebPart(webPart); webPartMngr.SaveChanges(webPart); } } The SaveChanges() has to be done else it just won't work. After the web part is closed, you can still find it in webPartMngr.WebParts collection to re-open it. The code is basically the same as how you would close it. Just change the CloseWebPart() to OpenWebPart() instead.

Customize SharePoint Blog

What I'm trying to do is to replace the default body field with one of custom HTML field for the blog post. Because the customization that we had already done on the HTML rich editor control. In general, there are 2 things that can be done 1) site definition, and 2) feature The first thing that I tried was creating a custom blog site definition from the OOTB site defintion, since modifying OOTB files is always against the best practice and can avoid warranty in some cases. The MOSS OOTB blog site definition is located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\Blog. Custom Blog Site Definision Make a copy of OOTB blog site definition and rename the folder to a unique name (i.e. CustomBlog) There are a few xml files that you can modified, onet.xml (in CustomBlog/Xml) and schema.xml in each list folder. After update the site definition xml files. You'll have to do an iisreset before the changes will take effect. I have modif...

Windows VS Mac

About 3 weeks ago, I bought a MacBook because I want to start writing some iPhone applications.  It's exciting and everything because all the commercial and advertisement on TV making Mac sounds so cool and wonderful.  For my entire life, I have been using Windows up until now.  With Mac there are a lot of getting used to and learn how to use a new OS. Things that I missed and not used to: Windows Explorer  - I still couldn't get used to the Mac Finder.  I'm so used to the tree view on the left navigation.  It's so easy for me to know where all the stuffs is.  Also, I can easily drag and drop files from one folder to another without opening another window. Cut and paste files  - you can only cut and paste text but not files.  So, when you want to move a file, you always need to Finder to be opened and drag the files to the new place. Software un-installation  - from what I research online, there is no consistent way of uninstalling software.  For most of the application...