Skip to main content

Posts

Showing posts with the label SharePoint 2010

Async Plugins vs. Power Automate Flows

SharePoint 2010: SPUtility.GetFullUrl(properties.Site, properties.ListUrl) in Custom Workflow and Alternate Access Mappings

While testing a custom SharePoint workflow that automatically sends out emails I stumbled over a small issue that bugged me and our customer a lot.   The email sends out some text with an url link to a list item. The problem was that the external url to the server was used only at the beginning of the workflow and later when the workflow continued through some internal trigger the internal server host name was used.   E.g.: External Url:  http://ext.alegri.eu Internal Url: http://stgalegri   I found out the in the alternate access mapping settings the default url was the internal url. I changed the settings to the following:     I have the following explanation for this behavior: When the workflow is started and the following code is used: SPUtility .GetFullUrl(properties.Site, properties.ListUrl) The Site.HostName property will be instanciated with the context of the calling user that open the web site via the external u...

SharePoint 2010: Taxonomy field and System.UnauthorizedAccessException

These days I had a problem with provisioning a list instance of a custom list definition which uses a taxonomy field. This feature is part of a custom site definition also. Interestingly I was able to use my site defintion to create a new site collection. All custom lists that had my taxonomy field on it did not make any trouble in this instance. But when I tried to create a sub web site with the same site definition the provisiong stopped with the following error: 10/27/2011 16:55:51.24 w3wp.exe (0x21D0) 0x197C SharePoint Foundation Feature Infrastructure 889w High The element of type 'ListInstance' for feature My.SiteDefinitions.Project.SGD_ProjectLists' (id: b7cbc5b3-decd-48ff-aa23-29fb7a0223f7) threw an exception during activation: Exception has been thrown by the target of an invocation. 0c0e2c1b-db4f-4619-911f-116a086ba2c1 10/27/2011 16:55:51.24 w3wp.exe (0x21D0) 0x197C SharePoint Foundation General 72by High Feature Activation: Threw an exception, attempting...

SharePoint 2010: Error on publishing a custom content type via content type hub

Recently I tried to publish a custom content type of my content type hub from within a feature receiver and received the following error: 10/27/2011 09:17:14.74 w3wp.exe (0x20A8) 0x0F5C SharePoint Server Taxonomy fj2u Unexpected Content type publish failed with exception. Proxy MMS - CTH. Content type IT Document Set. System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://sgdv01101:32843/8c74a6e67762437ea1547ee5f61d6236/MetadataWebService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ...

SharePoint 2010: SharePoint WebControls mystery

During a project I created a very complex custom newform.aspx / editform.aspx. Usually a custom RenderingTemplate uses the < SharePoint:ListFieldIterator ID="ListFieldIterator1" runat="server"/> control to automatically iterate all fields belonging to that list. But if you use field controls yourself, the ListFieldIterator is so smart not to render that field again. In my case I had to use the same field two times in different views in a multipage tab strip scenario. Within the first view I used this tag: < SharePoint:TextField ID="TextFieldViewA" runat="server" FieldName="TestField" /> In the second view this one: < SharePoint:TextField ID="TextFieldViewB" runat="server" FieldName="TestField" /> When rendering the custom page, SharePoint will only respond to changes on the second field. Somehow SharePoint uses the latest control in the control collection to update and persi...

How to correctly display a SPFieldCalculated with datatype DateTime

In this blog I want to talk about my recent experiences with displaying values from a SPFieldCalculated field with datatype "DateTime" in another Web control (asp textbox or label). My first approach was this: // Get calculated due date field values and set them in the textboxes SPFieldCalculated cf3Due = (SPFieldCalculated)SPContext.Current.ListItem.Fields[ "Due date" ]; DueDateField.Text = cf3Due.GetFieldValueAsText(SPContext.Current.ListItem[ "Due_x0020_date" ]); Later I figured out that using the first approach will not correctly apply timezone and region settings to the current datetime values. My next approach solved my issue with displaying the right datetime in the right timezone. But it took me several hours to find out this freaking solution. System.Globalization.CultureInfo ci = null ; SPRegionalSettings regSettings = null ; var user = SPContext.Current.Web.CurrentUser; // Always perform a Null-Check on SPUser.RegionalSettings ...

Struggling with SharePoint Field Controls (BooleanField)

In my code-behind I tried to set the CssClass property of a Microsoft.SharePoint.WebControls.BooleanField field during Page_OnLoad. During a debug session I could find out, that this control's CssClass property is "ms-input" by default. I overwrote it by different class name. This field gets rendered on the page like this: <TD class="ms-formbody No-Borders" vAlign=top align=middle><SPAN dir=none><INPUT id=ctl00_m_g_6796b238_94c6_47ff_bf38_ca66daa7a0d5_ctl00_AlertFormContent1_ConfirmationField_ctl00_BooleanField title="Quality Confirmation" type=checkbox name=ctl00$m$g_6796b238_94c6_47ff_bf38_ca66daa7a0d5$ctl00$AlertFormContent1$ConfirmationField$ctl00$BooleanField><BR></SPAN></TD> As you can see SharePoint actually does not render any CSS class style on this input field type. I am wondering why the CssClass is available and set by a default value although it does not get rendered. I would like to know why...

SharePoint 2010: Bug in Advanced Search Webpart

Today I found a nasty bug with the AdvancedSearchWebpart: I put the wepart on a standard web part page: Then I went into edit mode and deselected the other search text box fields so that I only have the first one "All of these words": Then I entered a search string "test" to see what's happening: The result was this:  I turned on the debugger to find the place where the error appeared: It crashed in the method "ComposeTextSectionQuery" because the hidden fields won't be rendered and therefore the attempt to access "elements.PhraseQueryTextBox.value" will result in the error mentioned above. I thought this was fixed with MOSS2007 already. Is Microsoft going steps backward with SP2010? I hope this will get fixed soon!

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 ...