Sebastian Soanca's SharePoint blog


Solution status stuck on ‘Deploying’

Posted in SharePoint 2007 by Sebastian on July 14, 2010
Tags: , ,

Today i deployed a solution from Visual Studio with WSPBuilder. After few minutes i look into Central Administration site, i and saw solution in Deploying state.
I cancel the deployment, and :

  • Re-deploy again.
  • Restarting IIS and re-deploy.
  • Restart  server.

None of the actions above didn’t solve my problem.

Solution:

I created a BAT file that executes all administrative timer jobs immediately instead of waiting for the timer job to run.

cd "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN"


stsadm -o execAdmSvcJobs

Using CAML to query Sharepoint lists over Lookup fields

Posted in SharePoint 2007 by Sebastian on July 2, 2010
Tags: , ,

If you have ever tried to query a SharePoint List, over a LookupList value with CAML, you know that the “supposed” CAML way to do it is over the “Title” field of the LookupList values.

For example, if we want to query the sharepoint list, which has a Lookup field “ProjectID”, and we want to extract all list items with the requested ProjectID, the CAML query would look like:

<Query>
<Where>
<Eq>
<FieldRef Name=”ProjectID” />
<Value Type=”Lookup”>My Test Project 1</Value>
</Eq>
</Where>
</Query>

Of course, it is not very practical, and basically it is useless when developing SharePoint based applications: what if Project’s name changes? Or maybe we do not store the Project’s name in the “Title” field, but in some other text field?

The only solution would be by writing a CAML which would query the same list, but over ID of the Lookup list. luckily, there is a way to do that:

<Query>

<Where>

<Eq>

<FieldRef Name=”ProjectID” LookupId=”TRUE” />

<Value Type=”Text”>3</Value>

</Eq>

</Where>

</Query>

Now, this query will return the same results like the previous query, only that we query LookupList data over it’s ID, which is much more convinient. And, ListItem is really easy to retrieve from the SharePoint Object Model

Source