Archive

Archive for the ‘Development’ Category

Custom SharePoint .ASPX form–“Could Not Load Type”

July 8th, 2010 admin No comments

This is starting to get dangerous…I’m blogging about SharePoint development twice in a row.  Again, this may be something very basic to most SharePoint developers, but as I learn, I enjoy blogging about issues I’ve discovered and things I’ve learned as I continue to develop more.

My next venture into SharePoint development is to create some custom .ASPX forms for use within our SharePoint environment.  For our situation, InfoPath Forms Services would make much more sense, unfortunately, we only have SharePoint 2007 Standard with no plans to go to Enterprise.

So, I created a very basic .ASPX file with an equally as simple .cs (code behind file), packaged it all up as solution and deployed it.  However, when I went to access the site, I encounter a “Could Not Load Type…” error.  After a quick search on Google, I found – http://blogs.catapultsystems.com/matthew/archive/2007/12/07/could-not-load-type-error.aspx between that post and the post by Andrew Connell that was referenced there I was able to solve my problem.

When I had created my .aspx file I had failed to use the “5 part name” to reference the assembly file.  I had put Inherits=”NewForm.NewForm” rather than Inherits=”NewForm.NewForm, NewForm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=*********”

As soon as I changed my .aspx file to use the 5 part name and redeployed my solution everything worked perfectly!

Reset Search Index – SharePoint Timer Job

July 7th, 2010 admin No comments

We have been having an issue with our search indexing and crawling in one of our SharePoint farms.  The problem is that after an undetermined set of time, pretty much all search queries wind up returning several results that show nothing but an IE icon.  The result isn’t attached or any page or give any textual information.  Obviously best case would be to figure out what causes this error, but at this point in time we haven’t been able to find the problem.

However, what we have discovered is that simply resetting the search index and running a full crawl will solve the issue.

So…until we can solve the issues, I wrote a small SharePoint timer job that simply resets our search index right before a scheduled full crawl runs.  I used Andrew Connell’s post (http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx) to develop the Timer Job, Solution and Feature and modified it and was able to find the following code on http://www.sharepointdev.net/sharepoint–development-programming/programmatically-reset-all-crawled-content-41959.shtml that I inserted into the timer job frame work in order to automatically reset our index on a regular schedule to minimize the risk of our search issue effecting the end users.

try
{
    SearchContext sc = SearchContext.GetContext(ServerContext.Default);
    sc.Reset(true);
}
catch (Exception ex)
{
    throw new InvalidOperationException("Unable to reset content index.", ex);
}

For some of you, this may not seem like much, but coming from the SharePoint Administration/Configuration side of SharePoint and having very little real development experience I was rather proud of myself.

SharePoint Memory Leak

February 15th, 2010 Ben 1 comment

As discovered by Todd Carter there is a memory leak in SharePoint 2007.  He has outlined the details as well as a work around to the fix the memory leak.

I decided to do some testing with it, however, when I compiled the dll, placed it into the GAC, and changed my global.asax file, I started getting this error: “Could not load file or assembly ‘[Assembly Name]’ or one of its dependencies.  The system cannot find the file specified.”

After digging into this error for a while I discovered my problem.  This may be fairly obvious to developers out there :) , but coming at this from more of a SharePoint administrator type roll, I missed this one step that isn’t outlined in the steps provided by Todd.

After deploying your dll to the GAC, you need to open up your web.config and place

<add assembly="[Assembly Name], Version=[Version Number], Culture=neutral, PublicKeyToken=[Public Key Token]" />

in the web.config file of the web application you wish to apply your fix to.  This line should be added between <assemblies> and </assemblies> in the web.config file.

All of the information: Assembly Name, Version Number and the Public Key Token can be found by right clicking on your dll in the GAC and viewing the properties of the dll.

Once I added the assembly to my web.config for the web applications I was trying to apply the fix to, everything worked as expected.

Hide Web Part Headers with SharePoint 2010

February 1st, 2010 Ben 4 comments

A while a go a write a short post on how to hide web part headers in SharePoint 2007.  Recently I had some inquire how to do the same thing for SharePoint 2010.  So, here is what to do in order to hide a web part header in SharePoint 2010.

1.  Add a content editor web part to your page.

2. Edit the Web Part

3. Click in the content area of the web part, click HTML and select “Edit HTML Source”

4. Put the following code in the web part:

  1. <style>
  2.   TR.ms-viewheadertr > TH.ms-vh2 {
  3.   DISPLAY: none
  4.   }
  5. </style>

 

5. Click “OK”

6. Expand “Appearance” (on the right side of the page)

7. Set the chrome type to “None”

8. Click “OK” and then save and check in your page.

The headers of your web part should now be hidden.  This can be extremely helpful when your page contains a web part using “boxed” for your style when creating a list view.  The only downside to this approach is if you have multiple web parts on a single page, it will hide the headers for all the web parts on your site.

How to do the same thing in SharePoint 2007

SharePoint support in Visual Studio 2010

February 20th, 2009 Ben No comments

Somasegar’s WebBlog post, http://blogs.msdn.com/somasegar/archive/2009/02/19/sharepoint-tools-support-in-visual-studio.aspx;, gives a great preview of the increased and additional support for SharePoint in the next release of Visual Studio

Visual Studio 2008 Extensions for SharePoint, v1.3 Feb. CTP

February 20th, 2009 Ben No comments

The February 2009 CTP of the Visual Studio 2008 Extensions for Windows SharePoint Server v3 have been made available for download. You can get them from http://www.microsoft.com/downloads/details.aspx?FamilyID=b2c0b628-5cab-48c1-8cae-c34c1ccbdc0a&DisplayLang=en

Categories: Development, SharePoint Tags:

Vegas!! (and the SharePoint Conference 2009)

February 3rd, 2009 Ben No comments

Again, EVERYONE is blogging about this, so I had to make my heading a little different.  Once again, in case you missed it, SharePoint Conference 2009 is in Vega this year.  It will be October 19 – 22.  It is for IT Professionals, IT Decision Makers, Architects and Developers with a plethora of classes for everyone.

According the Microsoft’s own site, “SharePoint Conference 2009 will be the conference to learn about SharePoint “14”."”

Register for the conference and get the early bird price!

SharePoint Dispose Checker Tool

February 3rd, 2009 Ben No comments

Ok, so I know everyone that is involved in SharePoint in some way and has a blog has written about this, but just in case you missed it…Microsoft has released the SharePoint Dispose Checker Tool.  The official announcement on the SharePoint Team Blog can be read here.  It is a great tool and is extremely useful for those of you developing SharePoint assemblies and making sure you are properly disposing of all your objects.  You can download the tool here.

Categories: Development, SharePoint Tags: