in

didierdanse.net

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

didierdanse.net - Development News

December 2008 - Posts

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

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