Skip to main content

Posts

Showing posts from 2010

How to create new (missing) columns for entities in your Data Export Service Azure SQL database

Regarding SPFieldMultiLineText (Add HTML/URL content to a field) programmatically

I recently tried so set some HTML content in a SharePoint list column of type SPFieldMultiLineText. My first approach was this piece of code: SPFieldMultiLineText field = item.Fields.GetFieldByInternalName( "Associated Documents" ) as SPFieldMultiLineText; StringBuilder docList = new StringBuilder(); docList.Append( " " ); foreach (DataRow docRow in addDocs) { DataRow[] parent = dr.Table.DataSet.Tables[0].Select( "DOK_ID=" + docRow[ "DOK_MGD_ID" ].ToString()); if (parent != null && parent.Length > 0) { docList.AppendFormat( " {1} " , parent[0][ "FilePath" ].ToString(), parent[0][ "Title" ].ToString()); } } if (docList.Length > 0) { // remove trailing tag docList.Remove(docList.Length-5, 5); } docList.Append( " " ); string newValue = docList.ToString(); item[field.Title] = newValue; What this code does is to get all associated documents to the main document and to add these docu

Business Data Catalog (BCS) Bug? in SharePoint 2010 with Actions and German umlauts (non-URL encoded)

In my *.bdcm BDC-model file I have a section: < Actions > < Action Position ="1" IsOpenedInNewWindow ="true" Url ="http://demo:5555/Company/userdefined/edit.aspx?id={0}&amp;etc=10022#" ImageUrl ="http://demo:5555/_imgs/ico_18_4002.gif" Name ="Projekt in MSCRM bearbeiten" > < ActionParameters > < ActionParameter Index ="0" Name ="ProjectID" /> </ ActionParameters > </ Action > < Action Position ="2" IsOpenedInNewWindow ="true" Url ="{0}" ImageUrl ="http://demo:5555/_imgs/ico_18_4002.gif" Name ="Projektportal öffnen" > < ActionParameters > < ActionParameter Index ="0" Name ="PortalUrl" /> </ ActionParameters > </ Action >

*.dwp and *.webpart confusion about Web Part implementation and usage in SharePoint

Recently I was really confused about which type of web part deployment file extension I should use. After some research I figured the following out (which might be interesting for all SharePoint newbies): .dwp is a web part description xml file used prior and up to SharePoint 2007/2010, therefore is still supported .webpart is the newer extension which came with MOSS 2007 So whats the true difference: .DWP: It uses the following namespace xmlns=http://schemas.microsoft.com/WebPart/v2 by default. The markup looks something like: <? xml version ="1.0" ? > < WebPart xmlns ="http://schemas.microsoft.com/WebPart/v2" > < Assembly > AssemblyName(with no .dll extension), Version=VersionNumber, Culture=Culture, PublicKeyToken=PublicKeyToken </ Assembly > < TypeName > WebPartNamespace.WebPartClassName </ TypeName > < Title > DefaultWebPartTitle </ Title > < Description > WebPartDescr

SP Error: A Web Part you attempted to change is either invalid or has been removed by another user.

Today I tried to get a custom Sharepoint web part to work. It was no fun because I had a pretty simple (once you figured it out) and tedious error. I added my custom web part on a standard SharePoint web part page and tried to edit the web part properties. I tried to just click on OK, Apply or Cancel I always got the following annoying message: A Web Part you attempted to change is either invalid or has been removed by another user. After spending a couple of hours, even with an experienced collegue, I finally found an interesting article: http://williamvanstrien.blogspot.com/2010/01/alluserswebpart-and-spwebapplicationapp.html William pointed out that it is a really bad thing to set the ID of a webpart control: "... When you add a control within an .aspx file, Visual Studio automatically add a default 'ID' property to the control. For the default WebPart however this is not needed, the property is actually set when creating a publishing page off this PageLayout. But

CRM-Error: SecLib::CheckPrivilege failed.

Today during a debug session this error occurred: Server was unable to process request. 0x80040220 SecLib::CheckPrivilege failed. Returned hr = -2147220960, User: 393528ec-10e4-de11-9707-000c29359a20, PrivilegeId: a3311f47-2134-44ee-a258-6774018d4bc3 Platform It looks like the user with id 393528ec-10e4-de11-9707-000c29359a20 does not have the privilege to do some action on an entity. How do we figure out what privilege it is? Answer is very easy: Open up the MS SQL Server Management Studio and go to the database "ORGNAME_MSCRM", open the table "dbo.PrivilegeBase" and shoot off the following SQL statement: SELECT [Name] FROM [ORGNAME].[dbo].[PrivilegeBase] where [PrivilegeId] = 'a3311f47-2134-44ee-a258-6774018d4bc3' The result was: prvReadEntity Now you know that user with id 3935.... requires the right to read an entity that was used in the request which caused this error.

Using class extensions in .NET 3.0 like in .NET 3.5

A customer had the requirement to develop his solution with .NET 3.0 framework. I was already used to the new and nice features of .NET 3.5 framework, especially the class extension feature. A simple example for a class extension would be like this: public class ReverseString { public static void Main() { string s = "Hello World!" ; string r = s.Reverse(); } } static class StringHelpers { public static string Reverse( this string s) { char [] c = s.ToCharArray(); Array.Reverse(c); return new string (c); } } In order to use the same feature under .NET 3.0 you can use the following trick: First create an empty class file (e.g. AttributeExtension.cs) and add this class to your project. Secondly put the following code in that class: using System; namespace System.Runtime.CompilerServices { /// <summary> /// Indicates that a method is an extension method, /// or that a class or assembl

Remove .NET Framework launch condition from a MSI file

As I created a VS2008 Web Setup project I always had to specify the .Net Framework launch condition. I found no way to deactivate this on the UI. To work around this problem I used Orca 3.1 (which also enables support and correct handling of x64 application files). Open up your MSI file and go to Edit->Find and search for: VSDCA_VsdLaunchConditions Delete all rows that contain this word and save the MSI file. Now you should have gone rid of this annoying behavior/feature.

The installer was interrupted before Application could be installed...

This error occured as I tried to install a custom installer web project, built with VS2008 in 32-Bit or 64-Bit mode on my 64-Bit target system. To get more details on that error, I tried the following command in my console window: msiexec /i /l*vx install.log The log file pointed out the following error: MSI (c) (60:54) [17:00:43:240]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (60:54) [17:00:43:240]: Connected to service for CA interface. INFO : [06/22/2008 17:00:43:346] [SetTARGETSITE]: Custom Action is starting... INFO : [06/22/2008 17:00:43:347] [SetTARGETSITE]: CoInitializeEx - COM initialization Apartment Threaded... ERROR : [06/22/2008 17:00:43:349] [SetTARGETSITE]: FAILED: -2147221164 ERROR : [06/22/2008 17:00:43:349] [SetTARGETSITE]: Custom Action failed with code: '340' INFO : [06/22/2008 17:00:43:350] [SetTARGETSITE]: Custom Action completed with return code: '340' Action ended 17:00:43: WEBCA_SetTARGETSIT