Home Blog Page 11

[SharePoint 2010 – Developpement] Create a Content Query Webpart in Site Definition (onet.xml), with dynamic site Url

2

I wanted to create a webtemplate with content query webpart in pages. Those webpart had to have the current site url. So I used the hack “~Site” in the properties of the webpart
Here are the step for it :

Step 1 : Create the Content query WebPArt Graphically

Create your webpart, and edit its properties (filter on content type, on column etc)

STEP 2:  Export the WebPart

From the page, export the webpart

STEP 3 : Modify the generated file exported .webpart

Modification 1 :
<property name=”ListGuid” type=”string”>d2d…
replace it by =>
<property name=”ListGuid” type=”string”/>

Modification 2 :
replace the property Weburl by
<property name=”WebUrl” type=”string”>~Site</property>

=> ~Site generates the website url dynamically

Step 4 : Integrate the CQWP in your onet.xml

In the AllUsersWebpart Tag, put the code of your webpart as that :
   1: <AllUsersWebPart
   2:           WebPartZoneID="Left"
   3:           WebPartOrder="1">
   4:           [CDATA[<webParts><webPart xmlns="http://schemas.microsoft.com/WebPart/v3%22>
   5:     <metaData>
   6:       <type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
   7:       <importErrorMessage>Cannot import this Web Part.importErrorMessage>
   8:     metaData>
   9:     <data>………..data>
  10:   webPart>
  11: webParts>]]>
  12:         AllUsersWebPart>

Deploy the solution and it will work Sourire

[CSS] Use different CSS for Internet Explorer specific versions, with hacks for IE 6 7 8

0

Everybody knows about Internet Explorer Css issues.
There are some useful hacks in order to target the right version of IE

   1: body { 
   2: border:1px solid red; /* standard */
   3: border:1px solid blue9; /* IE8 and below */
   4: *border:1px solid orange; /* IE7 and below */
   5: _border:1px solid blue; /* IE6 */

[SharePoint – Error Fixing] The specified solution was not found sharepoint (Sandboxed Office 365)

1

That error occured during the deployment.

This could happens when you delete a sitecollection, and re create an other one with the same name.
 
So respect that rule : during programming on a site collection, when you create a new site Collection, give it a new name.

[SharePoint 2010 – Error fixing] Failed to extract the cab file in the solution (sharepoint 2010)

0

When I tried to deploy my Visual Studio Solution for a Sharepoint 2010 site collection, I had that error :
failed to extract the cab file in the solution


What solved that problem :

  • I had parenthesis() in some List instance Names. So I renamed it.

Generally, explore your package, by going in Packaging Explorer of Visual Studio, and look for elements with parenthesis, ^ or special caracter.

[SharePoint 2010] How to change the !New (New) icon duration of a uploaded document (Sharepoint 2010)

0

 
When you upload a new document in sharepoint, it will display a new ! icon near by the document. You can change that value.

How to see the duration of !New icon on a document :

Stsadm –o getproperty –pn days-to-show-new-icon –url http://url/

=> The default value of the new icon on a document is 2

Define a new value


stsadm.exe -o setproperty -pn days-to-show-new-icon -pv 0 -url http://url/
Easy no ? Sourire

[SharePoint 2010 – Developpement & Administration] Getting started with Sharepoint 2010 : useful Tools

1

In order to help you to build and debug your sharepoint, you’ll need some tools

Sharepoint Manager 2010 (object model explorer)


A great tool permitting you to explore your Sharepoint Websites, content types, fields, library :
http://spm.codeplex.com/
There is a 2007 version available

Caml Builder

Generate CAML Query in a simply way
http://www.u2u.net/res/Tools/CamlQueryBuilder.aspx

[EDIT 04/02/2012]

 View Sharepoint Log in a better way :

Those log viewers enable the filtering, sorting function, really useful to search an error from its correlation ID

Uls Viewer

See logs of sharepoint in a better way. It also permits you to only display the errors, and search correlation id link to the error message
http://archive.msdn.microsoft.com/ULSViewer

and even better

SharePoint LogViewer

Same functions as Uls viewer, but the presentation is much better

http://sharepointlogviewer.codeplex.com/

[SharePoint 2010 – Developpement] Getting started with Visual Studio Tools for Sharepoint 2010

0

In order to help you to build your sharepoint, you’ll need some Visual Studio Tools

Generate page layout from a content type

 

When you create a Page layout heriting from a content type and you want to display the metadata on the page, you could use this great extension for Visual studio in order to generate the page layout.
http://visualstudiogallery.msdn.microsoft.com/en-us/990bd0c8-a55b-4643-a35d-88136594c3d9
Here a post from Waldek MastyKarz to explain how it works

Cks Dev Server

Add of lot of feature really useful, the one I use :

  • Permit you to generate page code for site definition (onet.xml)
  • Reboot IIS
  • Create Site definition in my current project, instead of creating a Site definition Project
  • etc

http://cksdev.codeplex.com/

[SharePoint 2010 – Error Fixing] Error when creating a new site based on a custom Site Definition : “ Taxonomy Catch All Field did not exist in the site columns “

0

When I created a new Site based on my Site definition, I got the following error from the LOGS :

“Taxonomy Catch All Field did not exist in the site columns “.

This was because I declared my list instance in the onet.xml :

<Lists>
<List FeatureId=”1875b07d-8d5a-445e-b7a6-23f0373b63a0″ Type=”101″ Title=”Documents QSE” Url=”$Resources:core,lists_Folder;/Documents QSE” QuickLaunchUrl=”$Resources:core,lists_Folder;/Documents QSE/AllItems.aspx” />
</Lists>
<Modules>

That was wrong though. I had to create the instance in the List Definition.
 
Hope this help