Jul 15th, 2007 by Sebastian

If you have this error and you did all of those things:
- reinstalled DLLs,
- checked custom aspx if they reference any misspelled DLLs,
- removed one by one all the custom solutions,
- ran the “SharePoint Products and Technologies Configuration Wizard”,
- thought “Let’s go for a lunch and then reinstall this machine”
Check the web.config Best thing would be to take it from other machine and compare with a diff tool.
Take a look at what was wrong in our case:
,
Lesson learned!
Posted in SharePoint, .NET
No Comments »
Nov 29th, 2006 by Sebastian
If you set up HeaderImageUrl property in HyperLinkColumn, the text from HeaderText will not be shown.
Take this code for example:
<asp:HyperLinkColumn DataTextField=”urn:schemas-microsoft-com:office:office#Author”
DataNavigateUrlField=”urn:schemas-microsoft-com:office:office#Author”
DataNavigateUrlFormatString=”/MySite/Public.aspx?user={0}”
HeaderText=”Author” HeaderImageUrl=”/_layouts/images/imnhdr.gif”>
The “Author” text will not be shown in this column’s header. Only the icon will be visible. Well there is a simple way to solve
this:
<asp:HyperLinkColumn DataTextField=”urn:schemas-microsoft-com:office:office#Author”
DataNavigateUrlField=”urn:schemas-microsoft-com:office:office#Author”
DataNavigateUrlFormatString=”/MySite/Public.aspx?user={0}”
HeaderText=”<img src=’/_layouts/images/imnhdr.gif’/>Author”>
hey, it works
Posted in SharePoint, Web Development, .NET
No Comments »
Sep 9th, 2006 by Sebastian
Our solution contains about 30 projects. There are web apps, windows services, web controls, web parts (usual stuff for SharePointers). One of them is a BuildApp. It contains only one empty file class1.cs but it’s there to register DLLs in GAC, web parts in SPS and restart appPool.
After installing Visual Studio 2003 SP1 the BuildApp is not compiled during build operation. VS detects that it’s up to date and leaves it. It’s cool, it should be like that (why it compiled it before?)
But if BuildApp is not compiled, post build events are not fired. This forces us to run them manually. Personally I am a lazy but productive developer so I decided to fix it.
To fool VS to think that the project needs to be compiled, open one of the compiled files (the empty file which nobody will edit again), change date to something in far future like 2010, edit file and save it.
If you use SourceSafe edit the file outside the VS and remove “read only” attribute manually (apply is after edit has been made).
Thanks to this trick VS will compile the project every time you do the “build” and run post build events - sweet!
It works for Visual Studio 2003 SP1 and Visual Studio 2005
Posted in Tips, Visual Studio
2 Comments »
Aug 31st, 2006 by Sebastian
Have you ever needed to build only one project, the one you are currently working on, rather than a whole solution (especially the webparts deployment projects)?
There is a shortcut “ctrl+shift+b” but it builds whole solution. If you want to build current project you have to take your hands off the keyboard, move your mouse and click (two times!) “Build/Build ProjectName“.
Well, you can create a shortcut for it and it’s easy!
Just go to Tools/Options/Environment/Keyboard, choose “Build.BuildSelection” command and assign a shortcut for it.

Now look at “Build/Build ‘ProjectName’” - we have a shortcut!

In VS 2005 this command has a “shift + F6” shortcut defined by default.
Posted in Tips, Visual Studio
2 Comments »
Mar 11th, 2006 by Sebastian
I’ve had a problem with this and I’ve seen other people having problem with this too.
If after making a SQL Full Text query like this:
SELECT
“DAV:getcontentlength”,
“urn:schemas-microsoft-com:office:office#Title”,
“Rank”
FROM Portal_Content..Scope()
WHERE (“DAV:getcontentlength” > 10000)
ORDER BY “DAV:getcontentlength”
using search.asmx web service you get this error:
<?xml version=”1.0″ encoding=”utf-16″?>
<ResponsePacket xmlns=”urn:Microsoft.Search.Response”>
<Response domain=”QDomain”>
<Copyright>Microsoft (c) Office SharePoint ™ Portal Server 2003</Copyright>
<Status>ERROR_SERVER</Status>
<DebugErrorMessage>Internal server error:Missing LinkUrl</DebugErrorMessage>
</Response>
</ResponsePacket>
it’s not a xml error. Just add this column to a select
“DAV:href”
and query it again
SELECT
“DAV:href”,
“DAV:getcontentlength”,
“urn:schemas-microsoft-com:office:office#Title”,
“Rank”
FROM Portal_Content..Scope()
WHERE (“DAV:getcontentlength” > 10000)
ORDER BY “DAV:getcontentlength”
Posted in SharePoint
No Comments »
Feb 20th, 2006 by Sebastian
Some time ago I was developing a web control which had to take a list of a SPListItems from a specific SPList from a current SPWeb. Simple thing. Code was also simple. I used SPControl.GetContextWeb and got the list I wanted. I wrote the code and everything was ok until… until during tests I got into a viewlsts.aspx page. This page welcomed me with a nasty error message:
System.Runtime.InteropServices.COMException
First thing that came to my mind was that the list was not found. Strange. That means that the list disappeared or the wrong SPWeb has been opened. To check it I printed the SPWeb.Url and SPWeb.Name properties. Url was ok, but the .Name was from totally different Web! That’s why the list couldn’t be found - SPControl.GetContextWeb opened some other Web.
Ok, ok. So let’s create SPWeb object manually. Dang, another problem. Page.Request.Url returns only “_layouts/1033/viewlsts.aspx“. But hey, the .Url property of our ‘wrong’ SPWeb object from context is correct, so why not use it. That was it, now everything works like a charm
Here’s the code:
private SPWeb GetCurrentSPWeb()
{
SPWeb contextWeb = SPControl.GetContextWeb(Context);
SPSite site = new SPSite(contextWeb.Url);
Uri contextWebUri = new Uri(contextWeb.Url);
SPWeb currentWeb = site.OpenWeb( contextWebUri.AbsolutePath )
return currentWeb;
}
The recommendation I’ve been told some time ago, says that it’s better to get the SPWeb from SPSite.OpenWeb and not from the context. As you can see recommendation is good because context sometimes doesn’t work like it should
Posted in SharePoint
No Comments »
Feb 2nd, 2006 by Sebastian
Since I’m working on VMWare machine on SharePoint, the little window named “Microsoft Development Environment has encountered a problem and needs to be close” become main part of my life.
Always when I got this message I had a close and send error to Microsoft buttons. I always send those error reports.
Few moments ago VS crashed again, but this time I got a window without the send button. What?, I guess the guys at Microsoft are just tired of those reports… just like we are tired of those crashes.
Check it out

[UPDATE 08 feb 2006]
wait, the ’send error’ button is back. I still can spam Microsoft with my error reports 
Posted in SharePoint, Visual Studio
No Comments »