<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Dev4Side.com</title><link>http://www.dev4side.com</link><pubDate /><generator>dev4side.com</generator><description /><language>en</language><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Dev4Side" /><feedburner:info uri="dev4side" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>What should you know before development in InfoPath 2010 </title><link>http://feedproxy.google.com/~r/Dev4Side/~3/Flh76ut5Wdk/what-should-you-know-before-development-in-infopath-2010-.aspx</link><pubDate>Mon, 28 Mar 2011 14:58:05 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/technical-articles/sharepoint-2010/what-should-you-know-before-development-in-infopath-2010-.aspx</guid><content:encoded><![CDATA[ A walkthrough guide that provides you few basic tasks that are good to be read before doing any dealings with InfoPath 2010 for SharePoint 2010<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/Flh76ut5Wdk" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/technical-articles/sharepoint-2010/what-should-you-know-before-development-in-infopath-2010-.aspx</feedburner:origLink></item><item><title>Dev4Side at Microsoft Technical Conferences in Italy</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/fbvCA8a4CBc/dev4side-at-microsoft-technical-conferences-in-italy.aspx</link><pubDate>Mon, 21 Feb 2011 09:42:08 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/2/21/dev4side-at-microsoft-technical-conferences-in-italy.aspx</guid><content:encoded><![CDATA[ 
<p><img src="/media/7799/banner_rectangle-28.png" width="180" height="150" alt="TechnicalConferences" style="float: right; margin: 10px"/></p>

<p>We are super-excited to announce that our team will be at the
event of the year in Italy: <a
href="http://www.mstechnicalconferences.it/default.aspx"
target="_blank"
title="Microsoft Tecnical Conferences 2011">Microsoft Tecnical
Conferences 2011</a>.</p>

<p>This event groups three of the most important conferences in
Italy about SharePoint 2010, SQL&nbsp;Server and Unified
Comunication.<br />
The location is Milan and the dates to save are: 19-20-21 April
2011.</p>

<p>Check-out the <a
href="http://www.sharepointconference.it/events/2011/agenda.aspx"
target="_blank"
title="SharePoint Conference 2011 agenda">Agenda</a>&nbsp;and <a
href="https://www.eventhandler.it/BoxOffice-v3/sites/MSTC2011/Register.aspx?c=MSTC2011SEB,MSTC2011EB&amp;p=9,11,13,21,22,25,26,29&amp;ps=25#registrationWizardChooseTypeStep"
 target="_blank"
title="Register to Microsoft SharePoint Technial Conferences 2011">register</a>
to attend the event !</p>

<p>Hope to see you there !</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/fbvCA8a4CBc" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/2/21/dev4side-at-microsoft-technical-conferences-in-italy.aspx</feedburner:origLink></item><item><title>Perfomances improvement on the content selection with the SharePoint 2010 Client Object Model</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/m1daNS586ag/perfomances-improvement-on-the-content-selection-with-the-sharepoint-2010-client-object-model.aspx</link><pubDate>Sun, 20 Feb 2011 11:15:44 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/technical-articles/sharepoint-2010/perfomances-improvement-on-the-content-selection-with-the-sharepoint-2010-client-object-model.aspx</guid><content:encoded><![CDATA[ How to improve performance over selections using Client Object Model in SharePoint 2010 client-side applications.<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/m1daNS586ag" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/technical-articles/sharepoint-2010/perfomances-improvement-on-the-content-selection-with-the-sharepoint-2010-client-object-model.aspx</feedburner:origLink></item><item><title>WCF Client Error  Can't find method SecurityTokenRequirement get_IsOptionalToken()</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/hf4AHJ526to/wcf-client-error--can't-find-method-securitytokenrequirement-get_isoptionaltoken().aspx</link><pubDate>Mon, 10 Jan 2011 17:04:34 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/1/10/wcf-client-error--can't-find-method-securitytokenrequirement-get_isoptionaltoken().aspx</guid><content:encoded><![CDATA[ 
<p>During a SharePoint 2010 development, I have encountered&nbsp;in
this stange error when i used a WCF client that needs to
authenticate with a webservice using the NTLM Autentication model
:</p>

<p><em><strong>WCF Client Error:: Can't find method: 'Boolean
System.IdentityModel.Selectors.SecurityTokenRequirement.
get_IsOptionalToken()'</strong></em></p>

<p>Be aware that this is a bug that can be solved after installing
a Microsoft hotfix and after restarting your server even if the kb
article says that the reboot is not required.</p>

<p><em><strong>Windows 2008 R2 and Windows 7</strong><br />
</em> KB article: <a
href="KB-article:// http//support.microsoft.com/kb/976462 Installer: http://code.msdn.microsoft.com/KB976462"
 target="_blank">http://support.microsoft.com/kb/976462<br />
</a> Hotfix: <a
href="KB-article:// http//support.microsoft.com/kb/976462 Installer: http://code.msdn.microsoft.com/KB976462"
 target="_blank">http://code.msdn.microsoft.com/KB976462</a></p>

<p><em><strong>Windows 2008 and olders</strong></em><br />
 KB-article: <a href="http://support.microsoft.com/kb/976394 "
target="_blank">http://support.microsoft.com/kb/976394<br />
</a> Installer: <a
href="http://code.msdn.microsoft.com/KB976394">http://code.msdn.microsoft.com/KB976394</a></p>

<p>&nbsp;</p>

<div
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"
 id="_mcePaste">KB-article:
http://support.microsoft.com/kb/976462</div>

<div
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"
 id="_mcePaste">
<p>Installer: http://code.msdn.microsoft.com/KB97646</p>

<p>&nbsp;</p>

<p>KB-article: http://support.microsoft.com/kb/976462</p>
</div>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/hf4AHJ526to" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/1/10/wcf-client-error--can't-find-method-securitytokenrequirement-get_isoptionaltoken().aspx</feedburner:origLink></item><item><title>How to manage the SharePoint 2010 Client Object Model exceptions</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/L9PHbyigv-0/how-to-manage-the-sharepoint-2010-client-object-model-exceptions.aspx</link><pubDate>Fri, 07 Jan 2011 09:44:25 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/technical-articles/sharepoint-2010/how-to-manage-the-sharepoint-2010-client-object-model-exceptions.aspx</guid><content:encoded><![CDATA[ Two ways to manage exceptions using SharePoint 2010 client object model<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/L9PHbyigv-0" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/technical-articles/sharepoint-2010/how-to-manage-the-sharepoint-2010-client-object-model-exceptions.aspx</feedburner:origLink></item><item><title>Incorrect dates taken from SharePoint 2010 Client Object Model</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/tKUsu6kAHrw/incorrect-dates-taken-from-sharepoint-2010-client-object-model.aspx</link><pubDate>Wed, 05 Jan 2011 09:40:01 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/1/5/incorrect-dates-taken-from-sharepoint-2010-client-object-model.aspx</guid><content:encoded><![CDATA[ 
<p>When using SharePoint 2010 client object model, I give for
granted that all data returned from my query on list elements were
correct. Better to say, I have never encountered any problem so
far, but I have never interacted with fieds like "Date and Time".
In this last week, I needed to read the elements present in a task
list and screen print them in a client-side application.</p>

<p>At the beginning, after reading all data of&nbsp; the SharePoint
list, I haven't noticed anything weird, but later on, I have
noticed a mismatch between the dates in my application and the ones
visible in the SharePoint 2010 interface.</p>

<p>Just try to create a new Task list in one of your SharePoint
2010 sites, add some tasks with different dates and paste this code
in a console application (after having added the reference both to
the Microsoft.SharePoint.dll library and to the
Microsoft.SharePoint.Client.dll client object model libraries and
Microsoft.SharePoint.Client.Runtime.dll):</p>

<pre>
Console.WriteLine("Client object model:");
ClientContext context = new ClientContext("http://sharepoint2010/");
using (context)
{
    List l = context.Web.Lists.GetByTitle("Tasks");
    ListItemCollection items = l.GetItems(CamlQuery.CreateAllItemsQuery());
    context.Load(items, its =&gt; its.Include(i =&gt; i["StartDate"]));
    context.ExecuteQuery();
    foreach (ListItem item in items)
    {
        Console.WriteLine("{0}", (DateTime)item["StartDate"]);
    }
}

Console.WriteLine("Server object model:");
SPSite site = new SPSite("http://sharepoint2010/");
using (site)
{
    SPWeb web = site.OpenWeb();
    SPList list = web.Lists["Tasks"];
    foreach (SPListItem item in list.GetItems("StartDate"))
    {
        Console.WriteLine("{0}", (DateTime)item["StartDate"]);
    }
}
</pre>

<p>If you follow this code on any SharePoint site (created with any
language, even the one of your client machine), I am sure you will
realize that there are different values for date and time.</p>

<p>If you don't believe me, have a look at this screenshot:</p>

<p><img src="/media/7606/wrongdates_497x245.jpg"  width="497"  height="245" alt="WrongDates"/></p>

<p>&nbsp;</p>

<p>As you can see, the first 4 dates are different from those in
the same list through the side server object model. Don't look at
the hours (as in my "Date and time" field the user was allowed to
add only the dates),&nbsp; but in these 4 values there is a
discrepancy of a day.<br />
I focused immediately on the bug (you can imagine why… :), then it
came up in my mind that my application is executed on the client,
so it is very likely that the language used is different then the
one used to create the SharePoint site (or the language used to set
the "Regional settings" section). As a matter of fact, getting back
the ToUniversalTime() method of the DateTime class, I understood
that the dates were exactly the same.<br />
Therefore, the problem was: "What can I do to visualize the dates
through the same culture of my client application?".<br />
I tried to use the ConvertToDateTime method moving the same culture
in the "Regional Settings" page of the SharePoint site, but it did
not work! Dates were still diverse.</p>

<pre>
DateTime s = Convert.ToDateTime(((DateTime)item["StartDate"]), new CultureInfo("en-US"));
Console.WriteLine("{0}", s);
</pre>

<p>By seeking in the SDK, I finally find the fantastic Utility
class and the even more amazing FormatDateTime&nbsp; method, which
executes the DateTime conversion according to the format you want
in the SharePoint 2010 "Regional Settings".<br />
When I apply it to my code, my date values are correctly visualized
as in my site interface.</p>

<pre>
Console.WriteLine("Client object model:");
ClientContext context = new ClientContext("http://sharepoint2010/");
using (context)
{
    Web web = context.Web;
    List l = web.Lists.GetByTitle("Tasks");
    ListItemCollection items = l.GetItems(CamlQuery.CreateAllItemsQuery());
    context.Load(web, w =&gt; w.Language);
    context.Load(items, its =&gt; its.Include(i =&gt; i["StartDate"]));
    context.ExecuteQuery();

    foreach (ListItem item in items)
    {
        DateTime start = ((DateTime)item["StartDate"]);
        ClientResult result = Utility.FormatDateTime(context, context.Web, start, DateTimeFormat.DateTime);
        context.ExecuteQuery();
        DateTime rightStart = Convert.ToDateTime(result.Value, new CultureInfo((int)web.Language));
        Console.WriteLine("{0}", rightStart);
    }
}
</pre>

<p>Practically, <strong>during a normal query through the
SharePOint 2010 clinet object model, dates go back to the client
application in the UTC format and need to be
converted.</strong><br />
Here it is the result when executing the second method (correct)
together with the first one (incorrect).</p>

<p><img src="/media/7611/rightdates_500x320.jpg"  width="500"  height="320" alt="RightDates"/></p>

<p>I also want to give you the sources, so you can try yourself
what I just said (without writing from scratch):</p>

<p><a
href="http://www.peppedotnet.it/zip/ClientObjectModelDates.zip"
target="_blank" title="Source code">ClientObjectModelDates.zip
(37,4 Kb)</a></p>

<p>Hope this helps..</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/tKUsu6kAHrw" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/1/5/incorrect-dates-taken-from-sharepoint-2010-client-object-model.aspx</feedburner:origLink></item><item><title>Retrieving the COM class factory for component with CLSID BDEADF26-C265-11D0-BCED-00A0C90AB50F failed due to the following error 800703fa</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/WebKPcLaAQc/retrieving-the-com-class-factory-for-component-with-clsid-bdeadf26-c265-11d0-bced-00a0c90ab50f-failed-due-to-the-following-error-800703fa.aspx</link><pubDate>Tue, 04 Jan 2011 15:40:14 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/1/4/retrieving-the-com-class-factory-for-component-with-clsid-bdeadf26-c265-11d0-bced-00a0c90ab50f-failed-due-to-the-following-error-800703fa.aspx</guid><content:encoded><![CDATA[ 
<p>If you receive</p>

<p><strong><em>Retrieving the COM class factory for component with
CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the
following error: 800703fa.</em></strong></p>

<p>and every SharePoint's page looks like this:</p>

<!--StartFragment-->
<p><strong>Server Error in '/' Application.</strong></p>

<hr />
<p>&nbsp;</p>

<p><strong><em>Retrieving the COM class factory for component with
CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the
following error: 800703fa.</em></strong></p>

<p><strong>Description:</strong> An unhandled exception occurred
during the execution of the current web request. Please review the
stack trace for more information about the error and where it
originated in the code.<br />
<br />
 <strong>Exception Details:</strong>
System.Runtime.InteropServices.COMException: Retrieving the COM
class factory for component with CLSID
{BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following
error: 800703fa.<br />
<br />
 <strong>Source Error:</strong></p>

<table border="0" style="width: 100%;" bgcolor="#ffffcc">
<tbody>
<tr>
<td><code>An unhandled exception was generated during the execution
of the current web request. Information regarding the origin and
location of the exception can be identified using the exception
stack trace below.</code></td>
</tr>
</tbody>
</table>

<p><br />
 <strong>Stack Trace:</strong></p>

<table border="0" style="width: 100%;" bgcolor="#ffffcc">
<tbody>
<tr>
<td>
<div>[COMException (0x800703fa): Retrieving the COM class factory
for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F}
failed due to the following error: 800703fa.]
Microsoft.SharePoint.Library.SPRequest..ctor() +54
Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite
site, String name, Boolean bNotGlobalAdminCode, String strUrl,
Boolean bNotAddToContext, Byte[] UserToken, String userName,
Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) +430
Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode
authenticationMode) +325
Microsoft.SharePoint.Administration.SPFarm.get_RequestAny() +136
Microsoft.SharePoint.Administration.SPTemplateFileSystemWatcher.RefreshInstalledLocales()
+60
Microsoft.SharePoint.Administration.SPTemplateFileSystemWatcher.Initialize()
+69
Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.System.Web.IHttpModule.Init(HttpApplication
app) +931
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +480
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +350
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +382 [HttpException (0x80004005): Retrieving the COM
class factory for component with CLSID
{BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following
error: 800703fa.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+11301814 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +4341684</div>
</td>
</tr>
</tbody>
</table>

<!--EndFragment-->
<p>you can fix this issue by setting the Load User Profile to True
in your site's Application pool's advanced settings:</p>

<p><img src="/media/7547/retrievingthecomerror.png" width="446" height="547" alt="retrieving-the-com-class-factory"/></p>

<p>After that, just reload your page and the problem should be
fixed.</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/WebKPcLaAQc" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/1/4/retrieving-the-com-class-factory-for-component-with-clsid-bdeadf26-c265-11d0-bced-00a0c90ab50f-failed-due-to-the-following-error-800703fa.aspx</feedburner:origLink></item><item><title>Enable or disable a SharePoint 2010 Ribbon control depending on the user selection</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/nwiiGiUdG_k/enable-or-disable-a-sharepoint-2010-ribbon-control-depending-on-the-user-selection.aspx</link><pubDate>Tue, 04 Jan 2011 09:35:34 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/1/4/enable-or-disable-a-sharepoint-2010-ribbon-control-depending-on-the-user-selection.aspx</guid><content:encoded><![CDATA[ 
<p>If we decide to customize the Ribbon bar, adding some custom
controls in a particular tab or group, we also have the chance to
decide when this Ribbon can be enabled or disabled. Obviously, the
one that is enabled (or disabled) will be the command that the
final user can execute by clicking on the Ribbon;&nbsp; then, the
SharePoint 2010 interface will have to renderize the Ribbon by
making immediately clear&nbsp; that it is not possible to execute
operations on the page content starting from that specific
control.</p>

<p>A Javascript function, which is added in the definition related
to the Ribbon command, will do the control. In particular, this
function should be added in the <strong>"EnableScript"</strong>
attribute of the "CommandUIHhandler" element and should be a
Boolean value, so the SharePoint 2010 interface can understand when
enabling or disabling the control.</p>

<p>In order to enable or disable our Ribbon control on the basis of
the selection by the user on the list elements, we have to use the
Client Object Model for ECMAScript offered by SharePoint 2010 and
its classes for the selection. Let's see how:</p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;CustomAction Id="Ribbon.HelloWorld"
                RegistrationId="101"
                RegistrationType="List"
                Location="CommandUI.Ribbon"
                Title="Hello world ribbon"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children"&gt;
          &lt;Button Id="Ribbon.HelloWorld.Button"
                  LabelText="Hello world"
                  TemplateAlias="o1"
                  Image32by32="/_layouts/images/PeppeDotNet/HelloWorld32by32.png"
                  Sequence="31"
                  Command="HelloWorld" /&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command="HelloWorld"
                          CommandAction="javascript:alert('Action for only one item !');"
                          EnabledScript="javascript:SP.ListOperation.Selection.getSelectedItems().length == 1;"/&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre>

<p>In the example, we have decided that our trial Ribbon should be
enabled only when the user has selected a single element. In the
<span>SharePoint team blog</span> you can find another
implementation of this behaviour, available through the
CountDictionary() function.</p>

<p><img src="/media/7472/helloworldribbon_10_497x205.jpg"  width="497"  height="205" alt="HelloWorldRibbon_10"/></p>

<p>&nbsp;</p>

<p>If the user has selected more elements or if he has not chosen
any yet, the button is disabled.</p>

<p><img src="/media/7467/helloworldribbon_09_500x195.jpg"  width="500"  height="195" alt="HelloWorldRibbon_09"/></p>

<p>&nbsp;</p>

<p><img src="/media/7477/helloworldribbon_11_500x194.jpg"  width="500"  height="194" alt="HelloWorldRibbon_11"/></p>

<p>&nbsp;</p>

<p>This allows to execute operations on single items of a
SharePoint list. Similarly, if we want to execute operations on
more than one item selected from a list, we would have to write the
code controlling that the user selection contains more than one
element (just the opposite as written before).</p>

<pre>
&lt;CommandUIHandler Command="HelloWorld"
                  CommandAction="javascript:alert(Action for multiple items !');"
                  EnabledScript="javascript:SP.ListOperation.Selection.getSelectedItems().length &gt; 1;"/&gt;
</pre>

<p>This allows to execute the same operation on more documents (or
items) selected by the user. In fact, the
SP.ListOperation.Selection.getSelectedItems() function, peculiar of
the client-side object model for ECMAScript (we will see a brief
introduction later on), will return a collection of elements
containing all the objects that have been selected by the user,
with their identifier, which are useful to execute our custom
operations.</p>

<p>If the selection is single, that function will return a
collection containing a single element.</p>

<p><img src="/media/7482/helloworldribbon_12_498x195.jpg"  width="498"  height="195" alt="HelloWorldRibbon_12"/></p>

<p><img src="/media/7487/helloworldribbon_13_496x190.jpg"  width="496"  height="190" alt="HelloWorldRibbon_13"/></p>

<p>&nbsp;</p>

<p>In these examples, we have used classes exposed by the
client-side object model for ECMAScript in order to enable or
disable our Ribbon control. &nbsp;We have the opportunity to do any
kind of calculation in our script, using one or more functions,
keeping in mind that the main function should return a Boolean
value.</p>

<pre>
&lt;CommandUIHandler Command="HelloWorld"
                  CommandAction="javascript:alert('Action only for work-hours !');"
                  EnabledScript="javascript:function enableRibbonOnWorkingHours() {
                                    var hour = getCurrentHour();
                                    return (hour &amp;gt;= 9 &amp;amp;&amp;amp; hour &amp;lt;= 18);
                                  };
                                  function getCurrentHour()
                                  {
                                    var d = new Date();
                                    return d.getHours();
                                  }
                                  enableRibbonOnWorkingHours();"/&gt;
</pre>

<p>In the following post we will see how to move externally to the
XML file of custom Ribbon definition (this means in a specific .js
file) all Javascript code that is used both for the control
activation and inactivation&nbsp; and for the action that needs to
be copied after the user has clicked on the control itself.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/nwiiGiUdG_k" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/1/4/enable-or-disable-a-sharepoint-2010-ribbon-control-depending-on-the-user-selection.aspx</feedburner:origLink></item><item><title>Custom Control Icon in the Ribbon Bar</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/v9Y2Rw3hNbM/custom-control-icon-in-the-ribbon-bar.aspx</link><pubDate>Mon, 03 Jan 2011 17:46:56 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2011/1/3/custom-control-icon-in-the-ribbon-bar.aspx</guid><content:encoded><![CDATA[ 
<p>In <span><a
href="/community/blog/2010/12/25/the-teampltealias-attribute-of-a-ribbon-control.aspx"
 target="_blank"
title="The TemplateAlias attribute of a Ribbon control">the
previous post</a></span>, we have seen how you can customize the
Ribbon control size in a tab and a group already present in the
Ribbon Bar. We have identified two main templates, respectively
defined with the alias "o1" and "o2", and we have seen that,
depending on which template you choose, different images are
visualized that represent our control.</p>

<p>In detail, some kind of controls can be represented by two
different images, obviously of different dimensions:</p>

<ul>
<li>Image 32 x 32: its URL should be defined in the "Image32by32"
attribute</li>

<li>Image 16 x 16: its URL should be defined in the "Image16by16"
attribute</li>
</ul>

<p><br />
Controls that offer the possibility of visualizing these two
different image formats are the following:</p>

<ul>
<li>Button</li>

<li>SplitButton</li>

<li>ToggleButton</li>

<li>FlyoutAnchor</li>
</ul>

<p><br />
We can define a further series of attributes which modify the
visualization in any of these two images. Here they are in
detail:</p>

<ul>
<li>Image32by32Class / Image16by16Class: CSS class name will be
applied to the image.</li>

<li>Image32by32Left / Image16by16Left: negative value representing
the offset to the left margin with which the image is
renderized.</li>

<li>Image32by32Top / Image16by16Top: negative value representing
the offset to the top margin with which the image is
renderized.</li>
</ul>

<p>The last two attributes are utilized by SharePoint to renderize
part of images containing icons that are useful to different
controls.</p>

<p>Other controls, which can be configured in order to visualize an
image in the Ribbon Bar, are the GalleryButton control (through the
"Image" attribute)and the Label control (which only contains the
"Image16by16" attribute).</p>

<p>If you wish more information about the schema of all the
controls you can add in the Ribbon Bar, please have a look at the
on-line documentation on this address:<br />
<a href="http://msdn.microsoft.com/en-us/library/ff458369.aspx"
target="_blank"
title="Server Ribbon Schema">http://msdn.microsoft.com/en-us/library/ff458369.aspx</a></p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/v9Y2Rw3hNbM" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2011/1/3/custom-control-icon-in-the-ribbon-bar.aspx</feedburner:origLink></item><item><title>The TeamplteAlias attribute of a Ribbon Control</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/Vhzr5VHiRtg/the-teampltealias-attribute-of-a-ribbon-control.aspx</link><pubDate>Sat, 25 Dec 2010 18:38:35 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/25/the-teampltealias-attribute-of-a-ribbon-control.aspx</guid><content:encoded><![CDATA[ 
<p>In the Ribbon bar customization, you have not only to specify
the tab and the group in which the controls related to our custom
Ribbon should be visualized (as we have seen in the <a
href="/community/blog/2010/12/16/our-first-ribbon-for-sharepoint-2010.aspx"
 title="Our first ribbon in sharepoint 2010">first</a> of posts
concerning Ribbon), but we also have to specify the way in which
these controls should be renderized.</p>

<p>In order to do so, any control, which can be added in the
extension of the developing SharePoint interface, shows the
<strong>TemplateAlias</strong> attribute. This attribute is
necessary to specify the template identifier you intend to use in
order to set a width and a size to this control, when a template is
applied to a group in which our custom Ribbon has to be added.</p>

<p>In the <a
href="/community/blog/2010/12/16/our-first-ribbon-for-sharepoint-2010.aspx"
 target="_blank" title="Our first ribbon in SharePoint 2010">first
example</a>, we have applied to the button the template with alias
<strong>"o1".</strong> This alias allows the rendering system of
the SharePoint 2010 Ribbon bar to set the maximum width and height
to the button. Besides, it applies to this button the image in
which the URL is defined in the "Image32by32" attribute.</p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;CustomAction Id="Ribbon.HelloWorld"
                RegistrationId="101"
                RegistrationType="List"
                Location="CommandUI.Ribbon"
                Title="Hello world ribbon"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children"&gt;
          &lt;Button Id="Ribbon.HelloWorld.Button"
                  LabelText="Hello world"
                  TemplateAlias="o1"
                 Image32by32="/_layouts/images/PeppeDotNet/HelloWorld32by32.png"
                  Sequence="31"
                  Command="HelloWorld" /&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command="HelloWorld"
                          CommandAction="javascript:alert('Hello world from BIG Ribbon !');" /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre>

<p>&nbsp;</p>

<p>We are already concerned in the result of a button with
"TemplateAlias" attribute valued with "o1".</p>

<p>&nbsp;</p>

<p><img src="/media/7397/helloworldribbon_07_500x98.jpg"  width="500"  height="98" alt="HelloWorldRibbon_07"/></p>

<p>&nbsp;</p>

<p>If we want to visualize our custom Ribbon in a smaller format,
we have to specify a new value for the TemplateAlias attribute.
This is the "<strong>o2"</strong> value, which specifies the
maximum text dimension, the position and the use of the image whose
URL is defined in the "Image16by16" attribute.</p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;CustomAction Id="Ribbon.HelloWorld"
                RegistrationId="101"
                RegistrationType="List"
                Location="CommandUI.Ribbon"
                Title="Hello world ribbon"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children"&gt;
          &lt;Button Id="Ribbon.HelloWorld.Button"
                  LabelText="Hello world"
                  TemplateAlias="o2"
                  Image16by16="/_layouts/images/PeppeDotNet/HelloWorld16by16.png"
                  Sequence="31"
                  Command="HelloWorld" /&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command="HelloWorld"
                          CommandAction="javascript:alert('Hello world from LITTLE Ribbon !');" /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre>

<p>Once the deployment is done, you will see our custom button
appearing in the second control group (in the "Manage" group of the
"Documents" tab), together with all those controls with minimum
height. If you wish to move before, during or after the other
controls already there, you can play with the "Sequence" attribute
values (as explained <span><a
href="/community/blog/2010/12/21/ribbon-position-management-on-sharepoint-2010-ribbon-bar.aspx"
 target="_blank"
title="Ribbon position management in SharePoint 2010">in this
post</a></span>).</p>

<p>&nbsp;</p>

<p><img src="/media/7402/helloworldribbon_08_500x89.jpg"  width="500"  height="89" alt="HelloWorldRibbon_08"/></p>

<p>&nbsp;</p>

<p>The template alias we have seen so far ("01" and "o2") are valid
when we want to add a control in one of the groups that already
exist in the SharePoint 2010 Ribbon bar. If we want to create
custom tabs and groups, we can define our custom templates for the
controls visualization.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/Vhzr5VHiRtg" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/25/the-teampltealias-attribute-of-a-ribbon-control.aspx</feedburner:origLink></item><item><title>Ribbon position management on SharePoint 2010 Ribbon bar</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/XSu-aHtwb2Q/ribbon-position-management-on-sharepoint-2010-ribbon-bar.aspx</link><pubDate>Tue, 21 Dec 2010 11:56:25 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/21/ribbon-position-management-on-sharepoint-2010-ribbon-bar.aspx</guid><content:encoded><![CDATA[ 
<p>As we have seen in our <span><a
href="/community/blog/2010/12/16/our-first-ribbon-for-sharepoint-2010.aspx"
 title="Our first ribbon in SharePoint 2010">first
example</a></span>, we can add custom Ribbon to a specific tab and
group, specifying the correct value in the "Location"
attribute.<br />
In this way, without further specification, all the items that
belong to our Ribbon (buttons, checkbox, etc…) will be visualized
as last in the group where the Ribbon has been added.</p>

<p><em><span>Note</span></em><em>: In this sense, it is necessary
to define what we mean with "last", as these controls will be
visualized after all those defined with the same "TemplateAlias"
(in the following posts we will explain how useful this attribute
can be).</em></p>

<p>In the figure below, what we see is that the "Manage" group of
"Documents" tab (belonging to every SharePoint 2010 site Document
Library) has two controls with "TemplateAlias" attribute with "o1"
value. These controls are needed in order to visualize the document
properties or their modification.</p>

<p>In the previous example, the custom Ribbon is positioned with a
"Hello World" label, after the other two.</p>

<p><img src="/media/7378/helloworldribbon_05_491x95.jpg"  width="491"  height="95" alt="HelloWorldRibbon_05"/>&nbsp;</p>

<p>If we want to move our custom button ahead (or in any other
position), we have to give our control "Sequence" attribute a whole
value.</p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;CustomAction Id="Ribbon.HelloWorld"
                RegistrationId="101"
                RegistrationType="List"
                Location="CommandUI.Ribbon"
                Title="Hello world ribbon"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children"&gt;
          &lt;Button Id="Ribbon.HelloWorld.Button"
                  LabelText="Hello world"
                  TemplateAlias="o1"
                  Sequence="1"
                  Command="HelloWorld" /&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command="HelloWorld" 
                         CommandAction="javascript:alert('Hello world from Ribbon !');" /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre>

<p>In this way, choosing to give the value 1 to the attribute (or a
number lower than 10), we have decided that our custom button
should be renderized as first in the "Manage" group of the
"Documents" tab.</p>

<p><img src="/media/7373/helloworldribbon_04_500x98.jpg"  width="500"  height="98" alt="HelloWorldRibbon_04"/>&nbsp;</p>

<p>If you specify the value <strong>11</strong> (greater than 10
and lower than 20), our custom Ribbon will be positioned between
the control of properties visualization and of editing.</p>

<p><img src="/media/7383/helloworldribbon_06_500x98.jpg"  width="500"  height="98" alt="HelloWorldRibbon_06"/></p>

<p>This is because every Ribbon, already present in the bar, has a
"Sequence" attribute value starting from 10 (for the first control
on the left) and goes in tens for every single following
control.<br />
In our example, the controls present in the "Documents" tab of the
"Manage" group have the following values for the "Sequence"
field:</p>

<ul>
<li>View properties - 10</li>

<li>Edit properties - 20</li>
</ul>

<p><br />
In order to visualize the correct values of each of the controls
present in the Ribbon bar and in the specific group that we have
chosen for the visualization of our customization to the SharePoint
2010 interface, we can sift through <strong>"CMDULXML"</strong>
definition file in the path:</p>

<p>C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\14\TEMPLATE\GLOBAL\XML</p>

<p><br />
Here you can see how these two controls are defined:</p>

<pre>
&lt;Button Id="Ribbon.Documents.Manage.ViewProperties"
        Sequence="10"
        ...
        TemplateAlias="o1" /&gt;
&lt;Button Id="Ribbon.Documents.Manage.EditProperties"
        Sequence="20"
        ...
        TemplateAlias="o1" /&gt;
</pre>

<p>If you are familiar with the custom actions in WSS 3.0/MOSS
2007, you have realized that the concept of sequence of action
visualization is exactly the same, with the only difference that,
in this specific case, this concept is applied to the Ribbon bar
and not to the context menu in the SharePoint interface.</p>

<p>In the next post we will see which are the available templates
to renderize a control in a group present in the SharePoint Ribbon
2010 Ribbon Bar.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/XSu-aHtwb2Q" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/21/ribbon-position-management-on-sharepoint-2010-ribbon-bar.aspx</feedburner:origLink></item><item><title>Our first Ribbon for SharePoint 2010</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/NfhsREYMeWU/our-first-ribbon-for-sharepoint-2010.aspx</link><pubDate>Thu, 16 Dec 2010 10:25:37 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/16/our-first-ribbon-for-sharepoint-2010.aspx</guid><content:encoded><![CDATA[ 
<p>SharePoint 2010 interface customization can be very useful in
order to carry out operations on lists and items or in order to
widen the normal SharePoint behavior in a way that you can add some
custom functionalities, which are useful for our
applications.<br />
One of the customization we can do is to develop a custom Ribbon we
can add to the&nbsp;Ribbon bar in the default layout of the new
version of SharePoint.<br />
First of all, it is very important to know that it is best practice
to use ribbons for all those operations that, in MOSS 2007/WSS 3.0,
give users a benefit through custom actions. In general, it is very
convenient to develop a Ribbon if you want to work on lists and
single or multiple list elements.</p>

<p>In order to define a Ribbon within Visual Studio 2010, we have
to create a "Empty Share Point Project" project type and add&nbsp;
a new "Empty element" element type.</p>

<p>&nbsp;</p>

<p><img src="/media/7322/helloworldribbon_01_500x264.jpg"  width="500"  height="264" alt="HelloWorldRibbon_01"/>&nbsp;</p>

<p>&nbsp;</p>

<p>This template type contains an empty xml file in which we can
define our Ribbon. As I said, the link between a Ribbon and the
custom actions we got to know in MOSS 2007 is very important, as we
use the "CustomAction" tag for the definition of our first custom
Ribbon.<br />
Here is an example that helps us clarify this last concept:</p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;CustomAction Id="HelloWorld"
                Title="Hello World"
                Location="CommandUI.Ribbon"
                RegistrationType="List"
                RegistrationId="101"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children"&gt;
          &lt;Button Id="Ribbon.HelloWorld"
                  TemplateAlias="o1"
                  Command="HelloWorld"
                  LabelText="Hello world"/&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command="HelloWorld"
                          CommandAction="javascript:alert('Hello world from ribbon !");" /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre>

<p>As you can see, like the custom actions of Sharepoint previous
version, we can choose to add our Ribbon in its related bar
(through "Location" attribute), the contest in which our Ribbon
will appear (through "RegistrationType" and "RegistrationId"
attributes) and what's new compared to the old version. We can
define which is going to be the extension to the interface
represented by our Ribbon.<br />
The extension is a single control or a series of controls (in our
example a simple button) that are going to be visualized in Ribbon
bar, in any of the available tabs and give custom actions to the
final users.<br />
In the following example, I have chosen my extension position in
the "Documents" tab that is present in all SharePoint 2010 Document
Library and in the "Manage" group. This choice is specified in the
"Location" attribute of the&nbsp;"CommandUIDDefinition" element
which represents my extension.</p>

<p>&nbsp;</p>

<p><img src="/media/7327/helloworldribbon_02_497x320.jpg"  width="497"  height="320" alt="HelloWorldRibbon_02"/></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><img src="/media/7332/helloworldribbon_03_500x298.jpg"  width="500"  height="298" alt="HelloWorldRibbon_03"/></p>

<p>&nbsp;</p>

<p>In general, to add our Ribbon in the different tabs and groups,
you have to follow this simple rule:<br />
<br />
<br />
<strong>Ribbon.[Tab].[Group].Controls._children</strong><br />
<br />
If you want the list of all the available tab and list identifiers,
you can address to the documentation of this website:</p>

<p><a href="http://msdn.microsoft.com/en-us/library/bb802730.aspx"
target="_blank"
title="Default Custom Action Locations and IDs">http://msdn.microsoft.com/en-us/library/bb802730.aspx</a><br />
<br />
Then, we can bind a specific command to every control (button,
checkbox, etc)that is present in our extension to the SharePoint
interface. This command will be one or more Java Script
instructions we can define in the "CommandAction" attribute of
the&nbsp;"CommandUIHandler" element, and this command is useful to
define the Ribbon behavior.</p>

<p>I'm not going more into details because there is a vast of
information that I will pick up in the next posts.<br />
I remind you if you want a pre-made project template for the
creation of a ribbon, you can find it in the Microsoft Code Gallery
on this address:</p>

<p><a href="http://code.msdn.microsoft.com/vsixforsp"
target="_blank"
title="Microsoft Code Gallery . Ribbon Project">http://code.msdn.microsoft.com/vsixforsp</a></p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/NfhsREYMeWU" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/16/our-first-ribbon-for-sharepoint-2010.aspx</feedburner:origLink></item><item><title>Error: "'b' is null or nota n object" using ECMA script client SharePoint 2010 object model</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/SoyKCAZ4uHs/error-'b'-is-null-or-nota-n-object-using-ecma-script-client-sharepoint-2010-object-model.aspx</link><pubDate>Sat, 11 Dec 2010 14:34:03 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/11/error-'b'-is-null-or-nota-n-object-using-ecma-script-client-sharepoint-2010-object-model.aspx</guid><content:encoded><![CDATA[ 
<p>In the last two weeks I worked a lot on the Client Object Model
for ECMA Script, related to the operations that <span></span>the
final user can do through Ribbon bar. I hope I can add some
contents for the <a href="/community/blog.aspx" target="_blank"
title="Dev4Side Blog">Dev4Side&nbsp;blog</a> and for the <a
href="http://www.sharepointcommunity.it" target="_blank"
title="Italian SharePoint Community">Italian SharePoint
Community</a>, because SharePoint 2010 UI Framework is very
nice.</p>

<p>However, while working I have encountered this error:</p>

<p><em>'b' is null or not an object</em>&nbsp;</p>

<p>This was triggered when I tried to retrieve properties of a
selected item, soon after having executed the executeQueryAsync()
method.<br />
This method requires the specification of two delegates in order to
call server side or to manage a possible error.<br />
In my case, the script did not reach neither the first
administrator nor the second one, but it was stopped during the
callback.</p>

<p>Here you can see the WRONG code I wrote:</p>

<pre>
var selectedItem;

function initializeScript() { 
   var items = SP.ListOperation.Selection.getSelectedItems(); 
   var context = new SP.ClientContext.get_current();
   var currentList = context.get_web().get_lists().getById(SP.ListOperation.Selection.getSelectedList()); 
   selectedItem = currentList.getItemById(items[0].id); 
   context.load(selectedItem);
   context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}

function onSuccessMethod(sender, args) { 
   alert('success');
}

function onFailureMethod(sender, args) {
   alert('fail');
}
</pre>

<p>Where is the error? The error is in the specification of the two
delegates names.<br />
In my script, I refer to onSuccessMethod and onFailureMethod
methods with the keyword "this". This script would work if I
extracted it from the "initializeScript" function, but being in the
function, the keyword causes error in the callback because the two
delegates cannot be found.<br />
Deleting the keyword "this", the callback mechanism understands
which are the methods that need to manage all the events. In this
way, everything works again.</p>

<pre>
var selectedItem;

function initializeScript() { 
   var items = SP.ListOperation.Selection.getSelectedItems(); 
   var context = new SP.ClientContext.get_current();
   var currentList = context.get_web().get_lists().getById(SP.ListOperation.Selection.getSelectedList()); 
   selectedItem = currentList.getItemById(items[0].id); 
   context.load(selectedItem);
   //context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
   context.executeQueryAsync(Function.createDelegate(this, onSuccessMethod), Function.createDelegate(this, onFailureMethod));
}

function onSuccessMethod(sender, args) { 
   alert('success');
}

function onFailureMethod(sender, args) {
   alert('fail');
}
</pre>

<p>So, If you encounter this error, you should know that the two
delegates names managing the callback should be written without any
errors.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/SoyKCAZ4uHs" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/11/error-'b'-is-null-or-nota-n-object-using-ecma-script-client-sharepoint-2010-object-model.aspx</feedburner:origLink></item><item><title>Error: "The local SharePoint is not available" in deployment from Visual Studio 2010</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/gEUs77pgLmU/error-the-local-sharepoint-is-not-available-in-deployment-from-visual-studio-2010.aspx</link><pubDate>Thu, 09 Dec 2010 11:11:36 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/9/error-the-local-sharepoint-is-not-available-in-deployment-from-visual-studio-2010.aspx</guid><content:encoded><![CDATA[ 
<p>If you deploy your SharePoint 2010&nbsp;solution for the first
time on a new development farm, it can happen that Visual Studio
2010 blocks the deployment operation and you get the following
error:</p>

<p style="color: red"><em>Error occurred in deployment step
'Recycle IIS Application Pool': The local SharePoint server is not
available. Check that the server is running and connected to the
SharePoint farm.</em></p>

<p><br />
Such error does not allow any solution deployment (even if it is
correctly compiled), because the logged on user in the SharePoint
machine and in Visual Studio 2010 does not have the permissions in
the following databases:&nbsp;</p>

<ul>
<li>SharePoint_Config</li>

<li>SharePoint_AdminContent_[guid]</li>
</ul>

<p>If you try immediately to deploy the solution to a specific
SharePoint 2010 web application, you will encounter this second
error:</p>

<p style="color: red"><em>Error occurred in deployment step
'Recycle IIS Application Pool': Cannot connect to the SharePoint
site: http://YOUR_SITE_NAME/. Make sure that this is a valid URL
and the SharePoint site is running on the local computer. If you
moved this project to a new computer or if the URL of the
SharePoint site has changed since you created the project, update
the Site URL property of the project.</em></p>

<p><br />
We have <span><a
href="/community/blog/2010/2/28/error-occurred-in-deployment-step-'recycle-iis-application-pool'.aspx"
 target="_blank">already discussed</a></span> this error, as it can
also be triggered when you manually move a project from a
Sharepoint machine to another one.</p>

<p>In this case, you need to have the permissions on the
<strong>content database</strong> linked to the deploying web
application.<br />
It is commonly known that you create ad hoc virtual machines for
development activities where the current user is an administrator
on the machine, but it can also happen that you need to
develop&nbsp; a server that you do not directly administrate and
that you access as a normal domain user.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/gEUs77pgLmU" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/9/error-the-local-sharepoint-is-not-available-in-deployment-from-visual-studio-2010.aspx</feedburner:origLink></item><item><title>How to add a site column to a content type through SharePoint object model</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/2yQhR7Ebf0c/how-to-add-a-site-column-to-a-content-type-through-sharepoint-object-model.aspx</link><pubDate>Sat, 04 Dec 2010 09:00:05 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/4/how-to-add-a-site-column-to-a-content-type-through-sharepoint-object-model.aspx</guid><content:encoded><![CDATA[ 
<p>Using SharePoint server-side object model and working with
SPField and SPContentType classes, we may need to create a site
column and then attach it to a content type that present in our
site collection (please check <a
href="http://www.peppedotnet.it/Blog/CreateCustomContentTypeProgrammatically.aspx"
 target="_blank">this post</a> for what it concerns the creation of
a content type through object model).</p>

<p>When it comes to managing the fields (through SPField class)in
SharePoint lists, what we would usually do is adding our SPField in
the SPFieldCollection exposed to the "Fields" property of our
content type:</p>

<pre>
SPContentType ct = web.ContentTypes["CONTENT TYPE NAME"];
SPField field = web.Fields.GetFieldByInternalName("COLUMN INTERNAL NAME");
ct.Fields.Add(field);
ct.Update(true);
</pre>

<p>Well, when you add an SPField in a content type and NOT in a
list, this code <strong>IS WRONG</strong>!</p>

<p>In fact, if you try to execute it, you will get this
error:<br />
<br />
</p>

<p style="color: red"><em>This functionality is unavailable for
field collections not associated with a list</em></p>

<p>Error triggered by the execution of SPFieldCollection Add()
method.<br />
The correct method to add a SpField (our site column) to a content
type is by using SPFieldLink class. Here is an example:</p>

<pre>
SPContentType ct = web.ContentTypes["CONTENT TYPE NAME"];
SPField field = web.Fields.GetFieldByInternalName("COLUMN INTERNAL NAME");
SPFieldLink link = new SPFieldLink(field);
ct.FieldLinks.Add(link);
ct.Update(true);
</pre>

<p>I hope it can be of help for you.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/2yQhR7Ebf0c" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/4/how-to-add-a-site-column-to-a-content-type-through-sharepoint-object-model.aspx</feedburner:origLink></item><item><title>SharePoint 2010 and the integration with different Office versions</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/JkqMYaMFq3I/sharepoint-2010-and-the-integration-with-different-office-versions.aspx</link><pubDate>Fri, 03 Dec 2010 12:34:54 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/3/sharepoint-2010-and-the-integration-with-different-office-versions.aspx</guid><content:encoded><![CDATA[ 
<p>A white paper has already been published for the version 2007,
where there is a list of the different characteristics and features
of Office packages for what it concerns the integration with WSS
3.0/MOSS 2007.</p>

<p>This white paper has been upgraded to SharePoint 2010 and Office
2010. You can find it in <span><a
href="http://download.microsoft.com/DOWNLOAD/2/A/A/2AA0D302-86A6-4AA2-A0A4-4F15FA7DBF5C/BUSINESS%20PRODUCTIVITY%20AT%20ITS%20BEST_WHITEPAPER.PDF"
 target="_blank" title="Microsoft download center">Microsoft
download site</a>.</span></p>

<p>This paper describes how the 2010, 2007 and 2003 versions of
Office can interact with SharePoint 2010, which are the
characteristics that are "lost" when utilizing a previous version
to Office 2010 and the integration innovations of these two
products.</p>

<p>As you know, every single SharePoint&nbsp; version gives its
best with the corresponding Office version.</p>

<p>SPS 2003 --&gt; Office 2003<br />
WSS 3.0/MOSS 2007 --&gt; Office 2007<br />
SharePoint 2010 --&gt; Office 2010</p>

<p>Obviously, the basic characteristics functioning of this
integration for the previous Office versions is guaranteed,&nbsp;
but for all the features of a new product there are some
limitations. These limitations are not present in the corresponding
Office version.</p>

<p>I suggest you to read the white paper where you can find a very
good explanation.</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/JkqMYaMFq3I" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/3/sharepoint-2010-and-the-integration-with-different-office-versions.aspx</feedburner:origLink></item><item><title>SharePoint 2010 libraries can only be used on applications compiled by .NET Framework 3.5</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/-hKhQnNPBes/sharepoint-2010-libraries-can-only-be-used-on-applications-compiled-by-net-framework-35.aspx</link><pubDate>Thu, 02 Dec 2010 11:39:48 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/2/sharepoint-2010-libraries-can-only-be-used-on-applications-compiled-by-net-framework-35.aspx</guid><content:encoded><![CDATA[ 
<p>If you try to create a new project with .NET Framework version 4
as Target Platform and to add Microsoft.SharePoint.dll library
among your project references, you will notice that such library
cannot be utilized with any other Framework versions but version
3.5!</p>

<p>In fact, using one of Share Point 2010 Server-side object
model&nbsp; class, you will encounter this error:</p>

<p style="color: red">
<em>System.PlatformNotSupportedException<br />
Microsoft SharePoint is not supported with version 4.0.30319.1 of
the Microsoft .Net Runtime.</em></p>

<p><br />
<img src="/media/7218/sharepointdllonlyon35_498x385.jpg"  width="498"  height="385" alt="SharePointDLLOnlyOn35"/></p>

<p>&nbsp;</p>

<p>In other cases, it can happen that straight after having
inserted the reference to SharePoint dll, everything seems to work
properly (intellisense, etc). But, with its first compilation, you
will find among the exceptions the following:</p>

<p style="color: red;"><em>The type or namespace name 'SharePoint'
does not exist in the namespace 'Microsoft' (are you missing an
assembly reference?)</em></p>

<p><br />
You cannot help that! Microsfot would say: "It's like that by
design". You cannot do anything about it.<br />
If we want to read or edit data in SharePoint from an application
that has been written using .NET Framework 4.0, we have to use the
exposed web services.<br />
<br />
<br />
</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/-hKhQnNPBes" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/2/sharepoint-2010-libraries-can-only-be-used-on-applications-compiled-by-net-framework-35.aspx</feedburner:origLink></item><item><title>Security Advisory 2416728 (vulnerability in ASP.NET) and SharePoint 2010</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/fuzOZ11a0ks/security-advisory-2416728-(vulnerability-in-aspnet)-and-sharepoint-2010.aspx</link><pubDate>Thu, 02 Dec 2010 10:57:59 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/2/security-advisory-2416728-(vulnerability-in-aspnet)-and-sharepoint-2010.aspx</guid><content:encoded><![CDATA[ 
<p>Recently Microsoft has released a <span>Security
Advisor</span>&nbsp;in which an important vulnerability is signaled
in all ASP.NET versions (from 1.1. to 4.0) which allows, in
particular condition, remote access to files.</p>

<p>This vulnerability has full effect if the ASP.NET application
has been configured through web.config to show the complete
error.</p>

<p>Microsoft has made a <span>script</span> available to control
automatically if your web.config files have this problem or not.
You can find more information about this directly on&nbsp;
<span>Scott Guthrie</span>'s website.</p>

<p>Beside, we should know that even SharePoint Foundation 2010 and
SharePoint Server 2010 are affected by the same vulnerability and
in <span>SharePoint team blog</span> you can find all the steps to
correct it.</p>

<p>The steps are the following:</p>

<ul>
<li>Open the directory %CommonProgramFiles%\Microsoft Shared\Web
Server Extensions\14\template\layouts.<br />
<br />
</li>

<li>Create a new file, named "error2.aspx" and add this
content:<br />
<br />
<br />
<pre>
&lt;%@ Page Language="C#" AutoEventWireup="true" %&gt;
&lt;%@ Import Namespace="System.Security.Cryptography" %&gt;
&lt;%@ Import Namespace="System.Threading" %&gt;

&lt;script runat="server"&gt;

   void Page_Load() {
      byte[] delay = new byte[1];
      RandomNumberGenerator prng = new RNGCryptoServiceProvider();
      prng.GetBytes(delay);
      Thread.Sleep((int)delay[0]);
      IDisposable disposable = prng as IDisposable;
      if (disposable != null) { disposable.Dispose(); }
    }

&lt;/script&gt;
&lt;html&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;Error&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div&gt;
        An error occurred while processing your request.
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;<br />
</pre>
</li>

<li>Open the directory
%SystemDrive%\inetpub\wwwroot\wss\virtualdirectories</li>

<li>For each subdirectory, follow these instructions:<br />
- edit the web.config file<br />
- retrieve customErrors section and change it as follows:<br />
<br />
<pre>
&lt;customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/_layouts/error2.aspx" /&gt;<br />
</pre>
</li>

<li>Save</li>

<li>Execute IISRESET /NOFORCE</li>
</ul>

<p>Please note that if you have changed the paths for your web
applications on file system, you should also change the contained
web.config.</p>

<p>If you don't want to do these operation manually, a WSP solution
has been created for you: you need to install it and it is able to
automatically adjust the vulnerability. You can find it on this
address:<br />
<a
href="http://shojeeb.com/sharepoint/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint/"
 target="_blank"
title="Security Advisory 2416728 workaround for SharePoint">http://shojeeb.com/sharepoint/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint/</a><br />
<br />
<br />
</p>

<p>I recommend to check immediately all these cases!</p>

<p>If you want to learn more, here there is a list of useful
links:<br />
- <a
href="https://www.microsoft.com/technet/security/advisory/2416728.mspx"
 target="_blank">Microsoft Security Advisory (2416728)</a>
(Vulnerability in ASP.NET Could Allow Information Disclosure)<br />
- <a
href="http://blogs.technet.com/b/msrc/archive/2010/09/17/security-advisory-2416728-released.aspx"
 target="_blank">Security Advisory 2416728 Released</a> (from
Microsoft Security Response Center blog)<br />
- <a
href="http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx"
 target="_blank">Important: ASP.NET Security Vulnerability</a>
(from Scott Guthrie's blog)</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/fuzOZ11a0ks" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/2/security-advisory-2416728-(vulnerability-in-aspnet)-and-sharepoint-2010.aspx</feedburner:origLink></item><item><title>Bug using Delay activity on SharePoint 2010 workflow</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/gScQlAMGfyM/bug-using-delay-activity-on-sharepoint-2010-workflow.aspx</link><pubDate>Wed, 01 Dec 2010 09:48:52 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/12/1/bug-using-delay-activity-on-sharepoint-2010-workflow.aspx</guid><content:encoded><![CDATA[ 
<p>In the <span>Italian SharePoint development forum</span>, there
is a very interesting topic about a Delay activity not working in a
sequential workflow created for SharePoint 2010.</p>

<p>Going into details, with a standard SharePoint installation, if
you try to develop a workflow that uses a Listen activity
containing a Delay activity that blocks the workflow for a set
number of minutes, you will notice that the operation flow will
stop forever. There will be no other way to make the workflow start
again after the defined set number of minutes contained in Delay
activity.</p>

<p>You can see in the picture below the workflow I used to test
this behaviour:</p>

<p>&nbsp;<img src="/media/7156/delayactivitybug.jpg" width="450" height="558" alt="DelayActivityBug"/>&nbsp;</p>

<p>Surfing on the net, we found that this problem has already
existed in the old SharePoint version (WSS 3.0/MOSS 2007) and it
has not been corrected.<br />
But... there is a solution!</p>

<p>In order to make a workflow using a Delay activity work, you
need to set a property on the site where you intend to run your
workflow, through STSADM utility.<br />
The property is "jabo-workflow", which should be valued with "Every
5 minutes between 0 and 59".</p>

<p>So, firstly we try to print the actual value of the property at
issue:</p>

<pre>
stsadm -o getproperty -pn job-workflow -url http://siteurl
</pre>

<p>Then, we can set it:</p>

<pre>
stsadm -o setproperty -pn job-workflow -pv "Every 5 minutes between 0 and 59" -url http://siteurl
</pre>

<p>When you are done with all the operations through STSADM
utility, you should remember that you need an IISRESET and a
restart of SharePoint timer service.<br />
In this way, the Timer service can control our workflows every 5
minutes and the Delay activity can work correctly.<br />
Do not forget that in order to debug such workflow, it is necessary
to attach to SharePoint OWSTimer process, otherwise our breakpoints
will never be caught by the debugger.<br />
Here you are the test solution I used to find the bug on my
machine:</p>

<p><a
href="/media/7161/peppedotnet.delayactivitybug.zip">
/media/7161/peppedotnet.delayactivitybug.zip</a></p>

<p>Hope this helps..</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/gScQlAMGfyM" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/12/1/bug-using-delay-activity-on-sharepoint-2010-workflow.aspx</feedburner:origLink></item><item><title>CHM Content for  IT pros on SharePoint Foundation 2010 and SharePoint Server 2010</title><link>http://feedproxy.google.com/~r/Dev4Side/~3/KRu9pBild9o/chm-content-for--it-pros-on-sharepoint-foundation-2010-and-sharepoint-server-2010.aspx</link><pubDate>Tue, 30 Nov 2010 10:30:24 GMT</pubDate><guid isPermaLink="false">http://www.dev4side.com/community/blog/2010/11/30/chm-content-for--it-pros-on-sharepoint-foundation-2010-and-sharepoint-server-2010.aspx</guid><content:encoded><![CDATA[ 
<p>From the Microsoft&nbsp; download center, there are available
two CHM for IT Professionist on SharePoint Foundation 2010 and
SharePoint Server 2010. Here you can download them:</p>

<ul>
<li><a
href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c8cf1631-0f48-4a02-a18d-54b04eb7f0a7"
 target="_blank"
title="Microsoft SharePoint Foundation 2010 Technical Library in Compiled Help format">
Microsoft SharePoint Foundation 2010 Technical Library in Compiled
Help format</a><br />
<br />
</li>

<li><a
href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=3629425d-1505-456e-89e2-ede95f75ffe5"
 target="_blank"
title="Microsoft SharePoint Server 2010 Technical Library in Compiled Help format">
Microsoft SharePoint Server 2010 Technical Library in Compiled Help
format</a></li>
</ul>

<p>&nbsp;</p>

<p>Hope this helps.</p>

<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/Dev4Side/~4/KRu9pBild9o" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://www.dev4side.com/community/blog/2010/11/30/chm-content-for--it-pros-on-sharepoint-foundation-2010-and-sharepoint-server-2010.aspx</feedburner:origLink></item></channel></rss>

