Montag, 28. Februar 2011

Problem with SPSiteDataQuery

... that SPSiteDataQuery always treats fields of type TaxonomyFieldTypeMulti as empty fields (remember that Language field is mandatory and all documents have some values in it)


http://sadomovalex.blogspot.com/2011/02/problem-with-spsitedataquery-and.html

Donnerstag, 17. Februar 2011

DisableLoopbackCheck on Error 401.1

Wenn Sie mithilfe des vollqualifizierten Domänennamens (FQDN) oder eines benutzerdefinierten Hostheaders eine lokale Website aufrufen, die auf einem Computer mit Microsoft Internet Information Services (IIS) 5.1 oder höher gehostet wird, wird möglicherweise eine Fehlermeldung etwa folgenden Inhalts angezeigt:

HTTP 401.1 - Unautorisiert: Anmeldung fehlgeschlagen


http://support.microsoft.com/kb/896861

Adding paging to SPGridView


oGrid.PageSize = 3;
oGrid.AllowPaging = true;
oGrid.PageIndexChanging += new GridViewPageEventHandler (oGrid_PageIndexChanging);
oGrid.PagerTemplate = null;
// Must be called after Controls.Add(oGrid)
   
 
http://blogs.msdn.com/powlo/archive/2007/03/23/Adding-paging-to-SPGridView-when-using-custom-data-sources.aspx

Unit testing Sharepoint


      
       
       
       

Some interesting Links

       
Roy Osherove (Der ausm Biergarten)
Homepage
           
21Apps
Homepage 
           
Richard Fennell (blackmarble)
Is Pex and Moles the answer to Sharepoint testing?
           
Channel9
Pex - Unit Testing of SharePoint Services that Rocks! ( Video, classified as unwanted by your administrator)
Video: Unittesting Sharepoint That Rocks ( Stored on S: )

           
Microsoft Research  
Pex Project
Pex and Moles - Getting Started with Pex
Unit Testing SharePoint Foundation with Microsoft Pex and Moles (PDF)


     
Downloads
PEX Academic (MSI)
TypeMock

Exception on starting Unittests


If you recieve this error during starting Unittests in Visual Studio
just open the "Team Explorer" and let VisualStudio establish a connection to TFS

Get all workflows associated with an item


SPWorkflowAssociationCollection.GetAssociationByBaseID(Guid BaseID) only returns "activated" workflows.
This means only workflows which have AutoStartCreate, AutoStartChange or AllowManual set to true will be returned.
To get all workflows associated with the item, just enumerate over the WorkflowAssociations member.

Approval of Listitems and Folders


Approving a Listittem
SPListItem item = …;
item.File.Approve("Initial Version");
 
Approving a folder
SPFolder folder = … ;
SPListItem li = folder.Item;
li.ModerationInformation.Status = SPModerationStatusType.Approved;
li.Update(); 

Using Moles with 64Bit


Add the following Directive to each Testclass 
[assembly: MolesAssemblySettings(Bitness = MolesBitness.x64)]

CSS styles used on Team Site

The following table summarizes selected top-level elements and CSS styles used on the default Team Site home page. Use this table as a starting point for understanding how to use cascading style sheets to customize SharePoint Foundation


http://msdn.microsoft.com/en-us/library/ms438349.aspx

Mittwoch, 16. Februar 2011

Do not use "MaintainScrollPositionOnPostBack = true" in WebParts

Using "this.Page.MaintainScrollPositionOnPostBack = true" will break javascript functions on the Webpage

xmlnamespace without prefix

Regarding the following XML, the XPath-Expression "//title" will only return the second title node.

The reason is the Namespace "withoutPrefix" which is defined without any Prefix, applying to all "nacked" nodes.

To retrieve the first title node, a "default" Prefix has to be added to the Namespacemanger.

Add the defined Prefix to your xPath-Expression and you 'll get the node.


<rootnode>
  <firstnode  xmlns="withoutPrefix" xmlns:inf="withPrefix">
    <title>the first title</title>
    <inf:type>nonsense</inf:type>
  </firstnode>
  <secondnode  xmlns:inf="withPrefix">
    <title>the second title</title>
    <inf:type>crap</inf:type>
  </secondnode>
</rootnode>


nsmgr.AddNamespace("default", "withoutPrefix");

string xPath = "//default:title");

Adding a ListViewWebPart to Page


[UPDATE 01.Feb.2012: wp.ViewGuid = string.Empty gilt nur für 2007]
Hier eine Erklärung für 2010
[ENDUPDATE]
[UPDATE: Set View to "Summary View"]


using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;

// Get a reference to a web and a list
SPSite site = new SPSite("http://localhost:8000");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Contacts"];

// Instantiate the web part
ListViewWebPart wp = new ListViewWebPart();
wp.ZoneID = "Left";
wp.ListName = list.ID.ToString("B").ToUpper();
// wp.ViewGuid = list.DefaultView.ID.ToString("B").ToUpper();
// Set the ViewGuid to string.Empty to get the "Summery View"
// including the "Add New Item"-Button
// Thanks to sadomovale
wp.ViewGuid = string.Empty;
// Get the web part collection
SPWebPartManager mgr = new SPWebPartManager("default.aspx", Storage.Shared);
// Add the web part
coll.Add(wp); 


Montag, 22. November 2010

Future of Silverlight Starts Now

The Future of Silverlight Starts Now
Hear the official news about what's coming up next for Silverlight from Scott Guthrie, Microsoft Corporate Vice President.

Managed MetaData

TechNet: Managed metadata overview (SharePoint Server 2010)

This article introduces the core concepts about managed metadata, and then describes the way you use managed metadata. An example is used throughout this article to illustrate the concepts. The final section presents several benefits of incorporating managed metadata into your SharePoint Server 2010 solution.

Adding a managed metadata column to a list via SharePoint Server 2010 object model
my solution for adding managed metadata type field to lists.
By Peter Holpar

Sonntag, 21. November 2010

Scrum and Visual Studio

Link

Die von vielen Anwendern lange ersehnte Prozessvorlage Microsoft® Visual Studio® Scrum 1.0ist ab sofort als kostenloser Download verfügbar. Bei Microsoft Visual Studio Scrum 1.0 handelt es sich um ein umfassendes Prozesstemplate für Team Foundation Server zur professionellen Abbildung eines vollständigen Scrum-Prozesses mit Visual Studio und Team Foundation Server. Microsoft Visual Studio Scrum 1.0 ergänzt damit die beiden vorhandenen Prozesstemplates MSF for CMMI® Process Improvement und MSF for Agile Software Development.

Branding hosted Sites

Link

Donnerstag, 28. Oktober 2010

Never remove SharePointWebControls:TextField runat="server" FieldName="Title"



<PublishingWebControls:EditModePanel runat="server" CssClass="edit-mode-panel">
<SharePointWebControls:TextField runat="server" FieldName="Title" />
</PublishingWebControls:EditModePanel>


Why?? What was the Problem

Dienstag, 26. Oktober 2010

How to Add a ListViewWebPart to a Publishing Page

neuer Versuch das ListViewWebPart zu verstehen







Adding a ListViewWebPart to a "Publishing Page" is easy.
Create a Instance of a SPWebpartmanager, with the relevant Page-Url and get the WebPartCollection.
Create a new ListViewWebPart instance, set the ListID to the ID of SPList object you want to show.
Provide a ViewID to the Webpart and add it to the Collection, including the ID of the WebPartZone and a Sequence Number for the order within the zone.


Showing a Document Library including the "Add document" Button  isn't easy at all.
In the UI it is just a click away -> Edit WebPart ->  select ToolbarType and set it to "Summary ToolBar".
I think its almost default in UI.

[UPDATE: see adding-listviewwebpart-to-page]
If you want to use OM to add this WebPart you have to use a "hack" by modifying the schema of the used view. Which can affect also the view of the document library.
Jalil Sear describes it at his blog listviewwebpart-programatically-setting-the-toolbartype-property/


I worked around this issue by adding my own "Add Document" button to the page, having the possibillity of positioning, using audiences and renaming.

Multiselect in MultiChoice

To get a default Selection of a Multichoice Field defined in a listdefinition
use the DefaultFormula-Tag


<list>
<CHOICES>
<CHOICE>Legal</CHOICE>
<CHOICE>Tax</CHOICE>
<CHOICE>Accounting</CHOICE>
<CHOICE>Asset Liability Management</CHOICE>
<CHOICE>Shareholdings</CHOICE>
<CHOICE>Risk Management</CHOICE>
</CHOICES>

<DefaultFormula>=";#Legal;#Tax;#Accounting;#Asset Liability Management;#Shareholdings;#Risk Management;#"</DefaultFormula>

</list>

Sonntag, 17. Oktober 2010

Das mächtige Sharepoint:DelegateControl

Chiris O'Brian beschreibt die Verwendung des DelegateControls unter MOSS 2007.
http://www.sharepointnutsandbolts.com/2007/06/using-delegate-control.html

panvega erklärt das DelegateControl in seinem Blog etwas ausführlicher

http://panvega.wordpress.com/2008/10/12/sharepoint-delegate-controls/
Für Sharepoint 2010 hat sich an dieser Stelle nichts geändert.

Ruchi hat in seinem Kommentar bzgl. Parametern auf folgenden MSDN -Artikel verwiesen:







IMHO sind Delegatecontrols eine einfache aber mächtige Methode um eine Sharepoint Site um Funktionalitäten zu erweitern bzw. auch um standardkomponenten auszutauschen.
In vielen Fällen kann man statt einem Webpart ein DelegateControl verwenden