Category: architecture

Dealing with corrupt WebConfigModification entries.

By , June 30, 2011 3:38 pm

Recently, I came across a problem.  I had created a new SharePoint Designer Custom Action and I created a feature solution package to deploy it to the production farm.  In testing it in a dev environment, I kept getting errors from the code I was using to make the appropriate web.config entries.  A custom SPD workflow action requires an ‘authorizedType’ entry in the web.config.  I have code in my feature receiver that will create a WebConfigModification entry in the WebConfigModifications collection and then use the SPService to apply the modifications.  (MSDN).  My problem was that someone had created a corrupt entry in the collection and it kept erroring out before executing my change.  It took a little understanding of how this works to find the solution to the problem.

The WebConfigModifications are a persisted object. That means that they remain until they are operated on.  In essence, it is a persisted queue.  Each entry is related to a SPWebApplication and added to the queue.  To remove the offending entry, I had to identify which web application the entry was registered with.  I just started going through every web application in my farm.  You could iterate through each application but in my case, I just hard-coded the URL for each application.  Here is the code that I used to clear the corrupt entries:


string siteUrl = @"http://localhost:44689";
SPSite site = new SPSite(siteUrl);
SPWebApplication webApp = site.WebApplication;
webApp.WebConfigModifications.Clear();
webApp.Update();
SPWebService service = SPWebService.ContentService;
service.WebConfigModifications.Clear();
service.Update();
service.ApplyWebConfigModifications();

I created a console app and put the code above in the Main() method. I kept executing the code using different web application URL’s until it executed without any error. Once I didn’t get an error, I was pretty sure that I had cleared the bogus entry. The next time I ran my feature code, it executed flawlessly!

A couple of notes. Obviously, this code is meant to be executed on the server and not a client. My dev machine has a single WFE. I would think that the best place to execute this would be on the same machine where Central Admin resides. Also – this was for a problem on a MOSS (WSS3) install. I am sure that it works the same in SharePoint 2010.

You can find the correct URL’s in IIS for each web application on your server. In my case, it was a shared development machine so there were many web applications executing under many different ports.

A SharePoint Design Question

By , February 4, 2010 1:10 pm

Normally, I write solutions to problems.  This time around, I need some suggestions to get ideas on how to design a solution to a problem.

The credit department where I work accumulates/produces documents to support the credit limit they grant our customers.  We have categorized them as :

  • Financial Statements
  • Agency Reports
  • Parent Guarantees
  • Other

We have defined a content type for each of these types of documents.  With each of these documents, one common field is the Company Name field that describes the company that the document refers to.

The Company is unique in it’s structure.  Each Company can be a Parent company or it can be the Parent to other companies.  I created a Company list that had the fields Name and Parent where Parent was a lookup field type to the Company list.  We currently have the list populated by about 4500 company names with the parent relationships defined.

List: Company

  • Company Name, Text Field (required)
  • Parent, Lookup of Company List (Company Name field) (not required)

In the document list that contains the four content types, each content type has a Company field that is a lookup to the Company List.

When we were discussing how to design this “application”, the user talked about how he would like to have a view where he could see all documents that related to a company, whether these documents applied directly to the company or one of it’s subsidiaries.  Another requirement would be that the documents for one particular company would be easy to find/view.

As for volume, each company (so far at 4500) will have at minimum 1 of each document types but more than likely will contain 10 – 20 documents with a small growth rate.  There is no document disposition being considered.  From their standpoint, once a document goes into the system, it becomes a historical record for that company.  So – we’re looking at about 45,000-90,000 documents initially and it will grow.

My original thought was that to stay within the 2000 item soft limit per view, I would create a folder in the Document Library for each Company created in the Company list.  I would then have the users save their documents in the folder that corresponded to the company name.  To achieve the view of the data where they could see all documents that applied to the parent and child companies, I would use the relationships defined in the Company list to create a custom view using the DataView Web Part.

So – here are my questions:

  1. Do I need a separate folder for each company?  Am I limiting myself?
  2. If we just use a Company Name field using the lookup list, would we run into performance problems?
  3. If we do use the folder, is there a way to automate the creation of the folder when I create a new Company in the Company List.
  4. If we do use folders, is there a way to prevent documents from being created outside of the folders?
  5. Can a document inherit a property from it’s parent?  (i.e. could a document get it’s company name by being saved into a specific folder with the right company name?
  6. (If folder) How do I prevent users from saving documents into the document library outside of a folder?

I’m sure there are more questions that I need to be asking.  It has been so long since I worked in Designer or the Web interface.  I’ve been living in Visual Studio for the last year.  Leave comments / remarks / insults.  Anything is appreciated.

Determining SQL Requirements for SharePoint

By , January 11, 2010 12:24 pm

Joel Oleson has a good post about determining your SQL server requirements in your SharePoint implementation.  A good resource for planning.

10 Key Questions Determining SharePoint SQL Server Count

Great SharePoint 2010 Planning Reference

By , January 11, 2010 11:13 am

Here is a list of SharePoint 2010 Architecture and Planning links.  I am mainly capturing this link for future reference!

http://rdacollab.blogspot.com/2010/01/sharepoint-2010-planning-and.html

Panorama Theme by Themocracy