in

didierdanse.net

Site personnel de Didier Danse
Didier Danse's Personnal Website
Microsoft Most Valuable Professional SharePoint

didierdanse.net - Development News

  • Microsoft TechDays Belgium: March 10-12 2009, Antwerp

    IT Professionals:

    • Come and learn more about how the System Center products can help you to manage your environment more efficiently
    • Explore the new functionalities in Windows Server such as virtualization, directory services
    • Find out what new enterprise features will be included in Windows 7
    • How to secure your environment with the Microsoft Security Products
    • How will the Microsoft Virtualization technologies help you simplify your IT Infrastructure
    • What improvements have been done in SQL Server 2008 to ease the management of your SQL infrastructure

    Developers:

    • Three developer tracks: Tools and Languages, Web and Client Experience, Servers and services (SQL Server 2008, SharePoint, Office)
    • Become familiar with the technologies released with .NET Framework 3.5 SP1
    • Learn how to use the technologies that will matter in the future, such as REST, cloud, WPF, XAML, …
    • Learn about Microsoft’s newest announcements around cloud computing (Azure)
    • See what is coming with Visual Studio 2010, .NET 4.0 (C# and VB)

    On March 10, at the preconference, you have the choice between three targeted tracks:

    • It Pro’s : Windows Server 2008 R2 Essentials
    • Developers: Deep-dive into development for Microsoft Office SharePoint Server 2007
    • Architects: Software + Services: the convergence of SOA, SaaS, Cloud Computing and Web 2.0 

    This event is not free but you will have the opportunity to listen and discuss with top speakers coming from all around the world.

    Early bird rate if registering before January 16th!

    Coming from Luxembourg? Send your coordinates and receive information about de{lux} package.

    Information and registration: http://www.microsoft.com/belux/techdays/about.aspx

  • SharePoint: A Proxy Web Service that allows the use of GetListItems in Lists.asmx from InfoPath

    When you call the GetListItems method in Lists.asmx Web Service, you have to pass some XML parameters. These parameters are not well understood by the Web Service so the use of this Web Service can be difficult and maybe impossible.

    XML parameters are written as strings in InfoPath window (I know that XML is just a string that follow some predefined rules).

    image

    This string which is encoded before pass it to the Web Service is no more understandable by the Web Service.

    As the problem is find we can do some additional tests. Calling the Web Service from a .NET application can be done without any issue. According to this, there is a solution: create and use a Proxy Web Service (coded using the .NET platform) that will be deployed to SharePoint platform. This Proxy will convert the string to a real XML content.

        <WebMethod()> _
        Public Function GetListItems(ByVal listName As String, ByVal viewID As String, ByVal query As String, ByVal viewFields As String, ByVal rowLimit As String, ByVal queryOptions As String, ByVal webID As String) As XmlNode
            Dim service As SharePointListsWS.Lists = GetWebServiceInstance(webID)
    
            Dim queryElement As XmlNode = CreateNode("Query", query)
            Dim viewFieldsElement As XmlNode = CreateNode("ViewFields", viewFields)
            Dim queryOptionsElement As XmlNode = CreateNode("QueryOptions", queryOptions)
    
            Return service.GetListItems(listName, viewID, queryElement, viewFieldsElement, rowLimit, queryOptionsElement, webID)
    
        End Function
    
        Private Function GetWebServiceInstance(ByVal webID As String) As SharePointListsWS.Lists
            Dim service As New SharePointListsWS.Lists
            service.Credentials = System.Net.CredentialCache.DefaultCredentials
    
            service.Url = SPContext.Current.Web.Url + "/_vti_bin/Lists.asmx"
    
            Return service
        End Function
    
        Private Function CreateNode(ByVal name As String, ByVal innerXml As String)
            Dim document As New XmlDocument
            Dim node As XmlNode = document.CreateElement(name)
            node.InnerXml = innerXml
            Return node
        End Function

    After having transform strings parameters to correct XML content, the Proxy Web Service will pass the XML parameters to Lists.asmx Web Service. This time GetListItems method is able to interpret the parameters. Values coming from the GetListItems method are returned directly to the client (in this case InfoPath).

    If you want to code this Proxy Web Service, you have to know:

    • How to code a Web Service;
    • How to modify auto-generated elements to allow integration to SharePoint platform;
    • How to add this Web Service to SharePoint platform.

    There is a few articles about each of these topics. If you don’t want to do all these points, you can just install the attached Web Service: Download

    It is quite easy as you just have to:

    • Unzip the attached file;
    • Click on install.bat.

    Attention! Be aware that the actual version of this package will erase and replace spdisco.aspx file. When uninstall the Web Service the file is deleted. You should test it on test environment before put it in production. Furthermore, you should backup the file before any other operation.

  • "Please insert the disk: Microsoft Visual Studio 2005 Professional Edition - ENU Disk 1" during Visual Studio 2005 installation

    Attention, some people should be offended by this solution as it is a quite stupid solution but it is the only one I know that work :-)

    1. Copy files from disk 1 to a drive on your computer. Example: c:\VS2005Install;
    2. Copy .cab files from disk 2 to the previously created folder;
    3. Then, run setup.exe available in the local folder.
  • Vista: How to authorize remote assistance?

    When you ask someone for remote assistance or someone propose you to do remote assistance, you could receive a message that indicates that remote assistance is not permitted because of the firewall. You can enable remote assistance through the firewall by following this procedure:

    1. Click on Start button (Vista image);
    2. Select Control Panel;
    3. Click on Authorize a program in Windows firewall”;
    4. Click on Continue when a window ask you the authorization to run the program;
    5. A window appears with the complete list of exceptions. Check the remote assistance option;
    6. Click on Ok.

    Now, you should have to possibility to use the remote assistance without any issue.

    Posted Dec 27 2008, 07:30 AM by Didier Danse with no comments
    Filed under:
  • How to avoid a complete IIS restart when deploying a SharePoint component?

    IIS (Internet Informations Services) is the web server made by Microsoft. When deploying a SharePoint component, it is recommended to restart this web server.

    But if you have a few applications on the same server, other applications will not be available until the web server will have finished the restart operation.

    We can avoid this by restart only a little part of this web server called Application pool. So we can restart the application pool that host SharePoint with this command:

    cscript.exe c:\windows\system32\iisapp.vbs /a SharePointAppPool

  • ASP.NET AJAX: All my UpdatePanel content are refreshed when post back occured instead of refreshing only one UpdatePanel content. Why?

    This post applies to all versions of ASP.NET AJAX.

    Here is the answer to a simple question that any beginner will deal with one day.

    Let’s imagine a web page with these contents:

    • Two update panels;
    • One timer;
    • One button and one label in each update panel.

    So our web page will have the following look (we should follow naming guidelines):

    image

    One trigger is associated with UpdatePanel1. The objective of this trigger is to perform a server asynchronous post back when Timer1 Tick event is raised:

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
            <ContentTemplate>        
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            </ContentTemplate>
        </asp:UpdatePanel>

    No trigger is associated with UpdatePanel2 but both (UpdatePanel1 and UpdatePanel2) are refreshed when the asynch post back is performed.

    By default, the UpdateMode property in each UpdatePanel is set to Always. As soon as a UpdatePanel post back is performed, all the UpdatePanel are refreshed.

    If you want to control how UpdatePanel are refreshed, you have to set the UpdateMode property to Conditional. So only triggers that are mapped with the UpdatePanel will refresh the content of this UpdatePanel.

        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
            <ContentTemplate>        
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            </ContentTemplate>
        </asp:UpdatePanel>
  • ASP.NET AJAX 1.0: When “Sys is undefined” happens and how to correct it?

    It is not a new problem but as someone asked me how to correct it, I decided to write the solution.

    After the installation of ASP.NET AJAX 1.0 Extensions on a machine with Visual Studio 2008, we could think that we will find a ASP.NET AJAX Enabled Web Application template but it is not the case as you can see on the following picture:

    image

    As we do not have any other choice, we have to select the ASP.NET Web Application. In the toolbox, we can see some the basic components from ASP.NET AJAX Extensions. Great!

    image

    It is really easy to use them with a simple drag and drop from the toolbox to the web page designer.

    As soon as we dragged the first component, some changes are persisted to web.config file (the easier way to see this is to have the web.config oprened in Visual Studio during the operation, you will be notified about changes):

    <assemblies>
                    <add assembly="System.Web.Extensions, Version=1.0.61025.0, 
    Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies>

    So we can think that everything is already as Visual Studio did everything thing for us. When the page is run, Sys is undefined error message appears in the browser.

    Why this? The answer is quite simple. In the HTML page source, we can find:

    <script src="/ScriptResource.axd?d=xyz" type="text/javascript"></script>
    <script src="/ScriptResource.axd?d=abc" type="text/javascript"></script>

    If we can and paste the url, we can have a look to the file content. But this url does not exist. In fact, the server does not know what to do with the .axd extension that is why we have to add the following content in the web.config between  <system.web> and </system.web>:

    <httpHandlers>
      <add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler"
    validate="false"/> </httpHandlers>

    Now, you can develop applications using AJAX and the only limit is your imagination.

    Minimal web.config:

    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>
        <httpHandlers>
          <add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler" 
    validate="false"/>
        </httpHandlers>
            <compilation debug="false">
                <assemblies>
                    <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"/>
                </assemblies>        
            </compilation>
            <authentication mode="Windows"/>
        </system.web>
    </configuration>

    You can find a complete web.config file by accessing the following path:

    C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025.

  • SharePoint: Slow uploads with IE6? Why?

    When you upload some files through the web interface, the upload take a lot of time but uploading these files using WebDAV (through the explorer view) is quicker.

    If you have Internet Explorer on the slow machines, you have found the issue source! If it is not the case, you could also read the following sentences as it could be a interesting point.

    The reason is simple: Internet Explorer 6 reads information from a registry key that contains the buffer size used for sending files. The default size is too small when sending file bigger than 2Mb to server. After a few seconds, the upload seems to stop (you can check this by having a look to the network monitor "Total Bytes/sec") and timeout is thrown.

    This issue does not happen with Internet Explorer 7 as the default value for the registry key has been changed.

    You will find the procedure for setting the key value here: http://support.microsoft.com/kb/329781/en-us

  • IE Dev Toolbar does not work. How to correct this?

    Most part of the time, developers use virtual machines with a Windows Server 2003 host operating system and Internet Explorer which is installed with the O.S.

    IE Dev Toolbar extension can be really useful when manipulating the web page DOM (it is more useful when used with Visual Studio 2008 JavaScript debugger). But as soon as the extension is installed, we restart Internet Explorer and then… Big surprise: Nothing is displayed in the toolbar window.

    image

    By default, the extension is not allowed to access web page content as the Internet access is not recommended from a server. So, options are set to fit this advice.

    If you want to allow access to the web page from IE Dev Toolbar, you have to edit Internet Explorer options. Check "Enable third-party browser extensions" option

    image

    Restart Internet Explorer and now you can use the extension

    image

    When using client Operating System (Windows XP, Windows Vista, ...) you do not have to these operations this option is already checked.

  • SharePoint: Get the item size

    We can create and use two functions:

    • GetAttachmentsTotalSize: get the size of the item attachments;
    • GetItemSize: get the size of the item attachments added to size of the content.

    GetAttachmentsTotalSize

        Public Function GetAttachmentsTotalSize(ByVal item as SPListItem) As Integer
            Dim size As Integer = 0
    
            For Each filename As String In item.Attachments
                Dim file As String = item.Web.GetFileAsString( _ 
                    item.Attachments.UrlPrefix + filename)
                size = size + file.Length
            Next
    
            Return size
        End Function

    GetItemSize

        Public Function GetItemSize(ByVal item as SPListItem) As Integer
            Dim size As Integer = GetAttachmentsTotalSize()
    
            For Each field As SPField In item.Fields
                If Not (item(field.Id) Is Nothing) Then
                    size = size + item(field.Id).ToString().Length
                End If
    
            Next
    
            Return size
        End Function

    You can use these functions in Workflows, Event Handlers and so on.

  • SharePoint: Be aware of group filtering in people field with moving sites using Content Migration API

    [Version française]

    If you use a field user in your lists which is filtered by using SharePoint group filtering and you intend to move your application from one environment to another through the content migration API, this post is for you!

    First, a quick reminder on how to filter the users on the basis of a group:

    In the definition of the list, click the name of the User column. Then, in the Properties window, just select the group used to filter users.

     02 

    What happened internally? The identifier of the selected group is stored in a property of the field. This is SPFieldUser.SelectionGroup property that receives and returns an integer as MSDN describe it: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfielduser.selectiongroup.aspx.

    This identifier (424 in our example) is in the URL when you change the group members:

    01

    At this time, there is no problem.

    A problem can occur when, using the content migration through API STSADM (STSADM - o export) or a custom tool (SP RAD Studio for example) , we export this site and then import it to another environment. Surprise! It turns out that the selected group for the filter does not match what we expected.

    03

    What has happened? The answer is simple. Only a identifier as an integer is used as we have seen. Looking at the package generated by an operation export, one might think that the import will no problem since found in the file Usergroup. xml as we found this information: <Group Id="424" Name="GroupName" [...]> but it is not the case.

    It will be necessary to manually edit this filter after migration. To do this, just use the web interface ... if we have the rights. Otherwise, one possible solution is to use STSADM extensions. I use this solution for performing all operations using a single script.

    This operation takes parameter the name of a SharePoint group (not an ID as we didnot know it):

    stsadm -o setfieldproperties -url <SiteUrl> -list <Listname> -field <Fieldname> -userfieldgroupfilter <GroupName>

    This extension is part of the extensions migration extensions available on CodePlex (http://www.codeplex.com/migrationstsadmext).

More Posts
L'auteur du site ne peut être tenu responsable des dommages que les informations fournies pourraient entraîner. Tout est cependant mis en oeuvre pour éviter tout désagrément.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems