in

didierdanse.net

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

didierdanse.net - Development News

  • Announcing DotNetHub !

    I’ve been working with some friends on a project for a while now, and it is finally time to talk about it more publicly as it is eventually coming to life : DotNetHub !

    DotNetHub is a new community about the Microsoft .Net Platform as well as the Agile Methodologies.

    DotNetHub will be a bit particular for 2 reasons:

    • First, it will be dedicated mainly to french-speaking people, mostly living in Belgium, Luxembourg, France & Switzerland (but, if you are elsewhere, don’t hesitate to contribute !). Why only french-speaking people ? Simply because there are already tons of english-speaking communities, all very good, but my friends and I felt that there was a void to be filled, especially here in Belgium (French people have DotNetGuru & Tech Head Brothers !).
    • Secondly, as mentioned, we will not only focus on technological aspects but also on the methodological ones, something that we find missing in other communities, but that is nonetheless as important. Bringing those two aspects together in the events & conferences we are going to organize will be a big challenge, but it’s worth it !

    We’re hoping to have many people joining us in order to create a very dynamic community. We are also actively looking for sponsors … so if you’re interested, please contact us.

    I’m already very happy to announce that our first event will take place on the 20th of January with Jonathan “Peli” de Halleux from Microsoft Research, who will talk about “Stubs, Moles & Pex“. Go register on the website, the number of places is limited !

    If you have any questions, suggestions, comments, … please visit us ! :-)

    Update : A more detailed presentation in french by Pierre-Emmanuel can be found here.

    (originally posted by Steve Degosserie on his blog: http://blog.yoot.be/index.php/2009/12/14/announcing-dotnethub/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Yoot+%28Yoot%29)

  • SharePoint: How to limit available site templates for site creation

    Once again, a colleague ask me if there is some possibilities to remove some site templates from the site creation page as she don’t want to allow power users to create sites based on custom site templates.

    The easiest way to do this is to click on Page Layouts and Site Templates on the Site Settings page. This link points at //_Layouts/AreaTemplateSettings.aspx">//_Layouts/AreaTemplateSettings.aspx">http://<yoursharepointurl>/<sitename>/_Layouts/AreaTemplateSettings.aspx page. This link is only available at the root site of the site collection but you can navigate to the page using the previous link.

    On this page, you will be able able to select site templates from available site templates list: 

    From a developer or an administrator perspective, there is also the possibility to use some code to manage available site templates.

    Here is a example of this code:

    public void SetAvailableTemplates(List<string> templateNames)
    {
         SetAvailableTemplates(templateNames, 0);
    }
    
    public void SetAvailableTemplates(List<string> templateNames, uint lcid)
    {
        using (SPSite site = new SPSite("http://<yoursharepointurl>/<sitename>"))
        {
            using (SPWeb web = site.OpenWeb())
            {
                if (lcid == 0) lcid = web.Language;
                Collection<SPWebTemplate> availablesTemplates = new Collection<SPWebTemplate>;
                foreach (SPWebTemplate template in site.GetWebTemplates(lcid))
                    if (templateNames.Keys.Contains(template.Name))
                        availablesTemplates.Add(template);
            
                if (availablesTemplates.Count > 0)
                {
                   // Code is different if site is a publishing site or not as some properties and methods are not exposed directly
                    if (PublishingWeb.IsPublishingWeb(web))
                    {
                        PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
                        if (lcid == 0) publishingWeb.SetAvailableCrossLanguageWebTemplates(availablesTemplates, false);
                        else publishingWeb.SetAvailableWebTemplates(availablesTemplates, lcid, false);
                    }
                    else
                    {
                        if (lcid == 0) web.SetAvailableCrossLanguageWebTemplates(availablesTemplates);
                        else web.SetAvailableWebTemplates(availablesTemplates, lcid);
                        web.AllProperties["__InheritWebTemplates"] = false.ToString();
                        web.Update();
                    }
                }
            }
        }
    }

    Now you can package this as a STSADM extension, a feature or anything else that can be imagined to manipulate your SharePoint.



  • SharePoint: Farm, web application, sites collection, sites and subsites, how to know what to use?

    Because of the scalability of SharePoint, each one who has to organize a SharePoint infrastructure is quickly set against an important question: What to use and at what time? There isn’t only one answer to this. Each element that composes an complete Infrastrcutre has typical properties and objectives. So we have to use the best container according to objectives and content.

    There is some kind of containers. The most important are:

    • 1a) SharePoint Farm (SPFarm from a SharePoint point of view)
    • 1b) Shared Services Provider
    • 2) Web Application (SPWebApplication)
    • 3) Sites Collection (SPSite)
    • 4) Sites (SPWeb)
    • 4) Sub sites (SPWeb)

    Mainly the first four elements (in blue) are used for technical reasons while the two other ones are used to structure sites and data from a logical point of view.

    So have a quick look through elements that are used in a SharePoint infrastructure. For more details, please use the best tool in the developers’ world: Internet.

    1.A) SharePoint Farm

    A SharePoint farm is a group of front-end servers, applicative servers (Shared Services), indexing servers and database servers. A SharePoint farm can be deployed to a particular location according to objectives (Internet access, geographical localization, …).

    image

    1.B) Shared Services Provider

    SharePoint Services Provider (SSP) is the composition of some farm-level services. These services are shared between all web applications and thus also between sites collections.

    These services are responsible of:

    • User Profile (profile properties, synch parameters)
    • Search (scopes, properties mappings, content sources, …)
    • Excel Services
    • Business Data Catalog

    image

    It is possible to use more than one SSP but it is highly recommended not to use more than useful. Using a lot of SSP can result to a complex SharePoint administration.

    2) Web Application

    There is nothing new for ITs or developers that already worked with sites or applications powered by ASP.NET, PHP or all server-side technologies. A web application characteristics are:

    • A site in IIS
    • A particular url
    • A authentication method associated with this web application

    image

    We can notice that a web application uses its own database in a SharePoint context (to be more precise, it is the case for new application. There is the possibility to create Web Applications extensions. These extensions can use different parameters that the main web application. We will use this when we want to share data between web applications and use different authentication modes for example).

    Furthermore, SharePoint is an ASP.NET application so it uses Web.config files. We will be able to add differents entries according to the objectives of the web application. We will remove some features if the web application is used by partners for example.

    Finally, a web application is always associated with a SSP.

    3) Sites Collection

    A sites collection is a virtual container (there is no physical file as it is the case for previously described elements) and sites collection structure is stored in a configuration database.

    Form an IT point of view, sites collection has some advantages. The main advantages are:

    • Content quota templates
    • Ease of maintenance (backup / restore is performed by site collection by default)

    image

    From a content manager point of view, we will notice that an administrator is defined each site collection. This administrator can manage:

    • Second level Recycle bin
    • Customized search
    • Users of the site collection

    Lastly, site collections is used to bring customized elements together and shared them with a audience that will access data across this sites collection (per example a department):

    • Master Pages
    • Images
    • Sites and lists Templates
    • Web parts

    There is always a root site in a site collection.

    image

    4) Sites and subsites

    In the beginning of this post, we told a lot of time of IT guys, a little bit about developers but I didn’t told about about end users even though they are the driving force of SharePoint content.

    At this level, everything is related to content management. According to the users permissions, they can:

    • Create sites
    • Create lists
    • Attach workflow to lists
    • Grant permissions
    • Restore deleted content
    • A lot of others operations!

    At this level, there is only one important thing to manage and organize data: company best practices and rules. It doesn’t matter where data are logically based, it will be physically stored in the same database. However, data should be spread all around sites and sub-sites. Do not hesitate to use important feature as permissions inheritance. It will help to organize data efficiently.

    image

    It is possible to add some code or reporting tools but the most important thing is the end-user and power-user training.

     

    Here is a SharePoint structure example:

    • Farm
      • Web Application 1
        • Sites collection A (with top-level site)
          • Site A.1
            • Site A.1.1
            • Site A.1.2
          • Site A.2
        • Sites collection B (with top-level site)
          • Site B.1
            • Site B.1.1
              • Site B.1.1.1
          • Site B.2
      • Web Application 2
        • Sites collection C (with top-level site)
          • […]
        • Sites collection D (with top-level site)
          • […]

     

    There is a lot things to write about this topic. I hope that you will have an understandable overview of SharePoint infrastructure and also the reasons of getting information from Internet or specialist.



  • SharePoint: How to use SPWebConfigModification class

    SharePoint provides a API that allows developers to modify web.config on all web front-end servers at the same time. This is really a nice concept as soon as it is used the correct way. All web.config modifications should (I could stay must) be performed through the API. Any direct change to web.config files can result in changes lost as this API will override entries in the config file.

    Like for all classes and APIs, developers should have a look to documentation to be able to use the API without bringing any mistakes in their code. Unfortunately, this API is poorly documented. The best documentation is coming from blog posts. There is a lot of posts all over the Internet but you have to read a lot of them if you want a global overview of use of this API. So have a look to this simple feature.

    SPWebConfigModification usual members

    First of all, a web config modification is described with a name, an owner name, an xpath value to define location of the change and a value.

    So if you want to add an entry in the web.config file, you have to know how we can define a unique identifier for the entry. As an example, you want to add <action param1=’value1’ param2=’value2’ param3=’value3’ /> and you know that only param3 should be changed, you have to define Name parameter to action [@param1=’value1’] [@param2=’value2’]. This part is the most obscure part of the SPWebConfigModification class and it is really important to understand why you have to use a correct name so let’s have the explanation: When applying modifications, API will read the web.config file and look for a entry with identifier. If it find such an entry, SPWebConfigModification will replace the current value. If not, it will add an new entry. So, if Name doesn’t fit with config entry, you will have duplicate value in the API.

    Owner property is also really useful. We will use it to know which entries we have to delete when deactivating the feature.

    Feature sample

    In this feature, we will add two entries in the web.config file and remove them when deactivating the feature.If you don’t know how to create a feature, please refer to MSDN Documentation.

    Feature.xml

    <?xml version="1.0" encoding="utf-8"?>
    <Feature  Id="1625EAF0-F3EB-4c4a-AB8A-36FDBD878AE8"
              Title="Company_FeatureName"
              Description="Used to add some entries in the web.config"
              Version="12.0.0.0"
              Hidden="FALSE"
              Scope="WebApplication"
              DefaultResourceFile="core"
              ReceiverAssembly="Company.FeatureName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0a1bc23456d78ef9"
              ReceiverClass="Company.FeatureName.WebConfigModificatorFeatureReceiver"
              xmlns="http://schemas.microsoft.com/sharepoint/">
      <ElementManifests />
    </Feature>

    Feature receiver

        class WebConfigModificatorFeatureReceiver : SPFeatureReceiver
        {
            private const string SPWebConfigModificationOwner = "OwnerName";
    
            public override void FeatureActivated(SPFeatureReceiverProperties properties)
            {
                string name, xpath, value;
    
                SPWebApplication webApp = (SPWebApplication)properties.Feature.Parent;
    
                #region ..: appSettings :..
                name = "add[@key='TrustedGroup']";
                xpath = "configuration/appSettings";
                value = "<add key='TrustedGroup' value='Trusted' />";
                ModifyWebConfig(webApp, name, xpath, value, SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode);
    
                name = "add[@key='KeyName']";
                xpath = "configuration/appSettings";
                value = "<add key='KeyName' value='Value' />";
                ModifyWebConfig(webApp, name, xpath, value, SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode);
                #endregion
     
                try
                {
                    webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
                }
                catch (Exception ex)
                {
                    RemoveAllModifications(properties);
                    throw ex;
                }
            }
    
            public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
            {
                RemoveAllModifications(properties);
    
                try
                {
                    SPWebApplication webApp = (SPWebApplication)properties.Feature.Parent;
                    webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();
                    eventLog.Source = SPWebConfigModificationOwner;
                    eventLog.WriteEntry(ex.Message);
                    throw ex;
                }
            }
    
            private void RemoveAllModifications(SPFeatureReceiverProperties properties)
            { 
                SPWebApplication webApp = (SPWebApplication)properties.Feature.Parent;
    
                List<SPWebConfigModification> modificationsToRemove = new List<SPWebConfigModification>();
    
                foreach (SPWebConfigModification modification in webApp.WebConfigModifications)
                    if (modification.Owner == SPWebConfigModificationOwner)
                        modificationsToRemove.Add(modification);
    
                foreach (SPWebConfigModification modification in modificationsToRemove)
                    webApp.WebConfigModifications.Remove(modification);
    
                webApp.Update();
            }
    
            private void ModifyWebConfig(SPWebApplication webApp, String nameModif, String pathModif, String valueModif, SPWebConfigModification.SPWebConfigModificationType typeModif)
            {
                SPWebConfigModification modification = new SPWebConfigModification(nameModif, pathModif);
                modification.Value = valueModif;
                modification.Sequence = 0;
                modification.Type = typeModif;
                modification.Owner = SPWebConfigModificationOwner;
    
                try
                {
                    webApp.WebConfigModifications.Add(modification);
                    webApp.Update();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();
                    eventLog.Source = SPWebConfigModificationOwner;
                    eventLog.WriteEntry(ex.Message);
    
                    throw ex;
                }
            }
    
            public override void FeatureInstalled(SPFeatureReceiverProperties properties) { }
    
            public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { }
        }

    Catching exception during ApplyWebConfigModifications

    If you run two ApplyWebConfigModifications simultaneously, an exception will be thrown during the second operation and modifications are not sent (I know, I said  simultaneously, I should say if you execute a ApplyWeConfigModifications before the end of another ApplyWebConfigModifications). Unfortunately, modifications are already in the modifications list but not applied in the web.config files and we will add them again during the next feature activation. Because of this, we will remove all the modifications ourselves before throwing the exception to caller.

    Scope of modifications

    What about the scope? Web config modifications can be applied by web application. To be more precise, this is a web application and all its extensions. It is not possible to apply modifications to a extended web application without applying these modifications to all the extensions.

    Entries conflicts

    Unfortunately, SharePoint doesn’t provide a solution for web.config conflict values (when two applications added the same entry) so when deactivating one of the feature, entry is removed and the second application may not work correctly.

    Entries modifications through UI

    Last but not least, if you want to modify a value without executing any code, you will have to use a page that is able to manage all the entries. You can find such a page here: http://blog.thekid.me.uk/archive/2007/03/24/web-config-modification-manager-for-sharepoint.aspx

    Hope this post will help!



  • Windows 7: How to display .chm content

    When you open a .chm file, you are in front of a Navigation to the webpage was canceled

    image

    First time, I was thinking that .chm was corrupted. It is not the case. In fact, there is a protection on files coming from other computers. You just have to open file properties and click on Unblock button.

    image

    After this, it works… Quite easy but sometimes it can be disturbing.

     image



  • SharePoint: Major bug found in Service Pack 2!

    This can be a little bit alarmist but did you read this post if it was not this title? :-) But be confident: bug is there and the solution also.

    During the installation of SP2, a product expiration date is improperly activated. This means SharePoint will expire as though it was a trial installation 180 days after SP2 is deployed. The activation of the expiration date will not affect the normal function of SharePoint up until the expiration date passes. Furthermore, product expiration 180 days after SP2 installation will not affect customer’s data, configuration or application code but will render SharePoint inaccessible for end-users.

    The way to modify Product ID is described in this KB: http://support.microsoft.com/default.aspx/kb/971620 

    More information: http://blogs.msdn.com/sharepoint/archive/2009/05/21/attention-important-information-on-service-pack-2.aspx

  • Download SharePoint Service Pack 2

    Since a few months, Microsoft delivers SharePoint updates using two packaging modes: Service Pack and Cumulative Updates. So if you want to have a updated SharePoint environment, you have to install:

    • The latest Service Pack
    • The latest Cumulative Udpate

    This time, we don’t have a new cumulative update but Service Pack so you have to install this SP only.

     

    Here is the links to download the SP:

    SharePoint Service Packs

    Windows SharePoint Services 3.0 Service Pack 2 (SP2) – English

    http://www.microsoft.com/downloads/details.aspx?FamilyID=79bada82-c13f-44c1-bdc1-d0447337051b&displaylang=en

     

    MOSS only: The 2007 Microsoft Office Servers Service Pack 2 (SP2)

    http://www.microsoft.com/downloads/details.aspx?FamilyID=b7816d90-5fc6-4347-89b0-a80deb27a082&displaylang=en

     

    Language Pack Services Packs

    Windows SharePoint Services 3.0 Language Pack Service Pack 2 (SP2)

    32 bits: http://www.microsoft.com/downloads/details.aspx?FamilyID=085e5ac8-58f6-4cf9-8012-33b95ee36c0f&displaylang=en

    64 bits: http://www.microsoft.com/downloads/details.aspx?FamilyID=2c2b6caf-b46d-45eb-ac4d-deaaa48c3a2c&displaylang=en

     

    MOSS only: The 2007 Microsoft Office Servers Language Pack Service Pack 2 (SP2)

    32 bits: http://www.microsoft.com/downloads/details.aspx?FamilyID=01c6a3e8-e110-4956-903a-ad16284bf223&displaylang=en

    64 bits: http://www.microsoft.com/downloads/details.aspx?FamilyID=66c5026f-9f47-4642-8378-2526918009fa&displaylang=en

  • Office: SP2 will be released at the end of the month

    Microsoft Update team announced on his blog that Office SP2 will be available on Microsoft Update at the end of the month. Maybe it will be available a few days before on Microsoft downloads sites. Just wait…

    Source: http://blogs.technet.com/mu/archive/2009/04/14/service-pack-2-for-2007-microsoft-office-system-due-april-28th.aspx

  • SharePoint Designer is now free!

    A few weeks ago, some people said that SharePoint Designer will be free. Now it is official. You can download SharePoint Designer as a free tool.

    It is really a good news … ‘til you let experimented users to use it. SharePoint Designer should be used in a structured infrastructure if you don’t want to correct errors because of risky customization.

    Download page: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42

  • SharePoint: How to allow a user to configure Search without granting access to all pages of Central Administration

    Every SharePoint administrator knows what is Central Administration. Developers should also be aware of what is available through this user interface. Depending of what kind of sites (applications) are developed, search scopes and meta data properties mappings must be added. So, who should be able to do this configuration?

    I won’t write about the usual discussion around roles and responsabilities but at the end of this post we will be able to grant access to search settings.

    To be allowed to configure SharePoint Search (scopes, rules, …), Read permission on the concerned Shared Service must be granted to the user that has to do this: http://servername:port/ssp/admin/_layouts/user.aspx.

    (Source: http://technet.microsoft.com/en-us/library/cc262918.aspx)


    image 

    Every user (direct reference or group reference) that has Read permission can have the following page:


    clip_image002

    As you can see, there is a lot of links on this page. Most of them linked to access denied pages. So, with Read permission granted, we have access to:

    • Trusted My Site host locations
    • Published links to Office client applications
    • Search settings

    First two ones will produce a read-only content. No modifications are allowed.

    In the Quick Lauch, Back to Central Administration and Shared Services Administration pages are also not available without more than Read permission. So the only one that is available is Search Settings (http://servername:port/ssp/admin/_layouts/searchsspsettings.aspx).

    Through this user interface, we are able to manage all search properties.

    Sometimes, 403 error can happen after these operations. Because of this, we should run attrib –s c:\windows\tasks using command line. This command will change System attribute on scheduled tasks folder. Don’t be afraid, we will set the attribute to previous one at the end of the operations.

    After this, right click on c:\Windows\Tasks folder and check if WSS_WPG has Read and Write access on the folder.

    As I wrote before, we will set System attribute to the previous one: attrib +s c:\windows\tasks.

    Check also that WSS_WPG and your fonctional account have some permissions on OSearch component.

  • Internet Explorer 8 is available for download

    Internet Explorer 8 is now final and available for download.

    image

    From a user point of view, there is only a few changes but this new version exposes a lot of new functionnalities. Coming from the most visible functionnalities, there are better performances, better CSS support and a lot of things like suggestions. You can find the complete list of new things here:  http://www.microsoft.com/presspass/newsroom/windows/factsheets/IE8FS.mspx

    From a developer sight, we are happy to see that a new development tools window is available

    image

    Download Internet Explorer here: http://www.microsoft.com/ie8

  • How to test web applications with different versions of Internet Explorer

    When we develop applications that are accessible from a web browser, we should check that this application can be accessed and used by most used browsers. So we have to install Firefox, Chrome and all other browser we want to use.

    But how can we test applications with different versions of the same browser? We cannot easily install differents versions of Internet Explorer on the same workstation.

    There is a tool free of charge that allow use of multiple version of Internet Explorer: IETester.

    IETester is a free WebBrowser that allows you to have the rendering and javascript engines of IE8 RC1, IE7 IE 6 and IE5.5 on Vista and XP, as well as the installed IE in the same process.
    New in v0.3 : IE8 RC1, zoom feature and a lot of corrections and improvements !

    Download: http://www.my-debugbar.com/wiki/IETester/HomePage

    Have a good testing session!

  • SharePoint: STSADM –o blockedfilelist doesn’t work?

    You runned

    stsadm –o blockedfilelist –extension .exe –delete

    and received an Operation Successful result. Great! You can now upload .exe files to your SharePoint. You think that you can do this but… SharePoint doesn’t allow this upload. Strange! Operation successfully completed isn’t it?

    In fact, it succeed but didn’t act as expected. You authorized .exe upload file to the Central Administration instance and not your content site.

    To correct this, you just have to add an url parameter and specify your SharePoint instance:

    stsadm –o blockedfilelist –extension .exe –delete –url http://servername
  • SharePoint: How to debug event handlers

    Every SharePoint developper is quickly in front of web parts development or workflows. Unfortunately, when things are wrong, only a few of them know how to debug, analyse and correct the code without problems. All developers had to do this and know that less it last, greater it is.

    So, here is a little how-to article about event handlers debugging.

    I will not write more about event handlers usage or deployment. If you want to have information about event handler, follow the link: MSDN. The most important part for us is that event handlers are deployed to SharePoint bin folder or Global Assembly Cache (GAC). Furthermore, assemblies containing event handlers are loaded dynamically when needed.

    Event handlers management tools

    Some management tools are available all across the Internet. Most part of them are free of charge. From my personal point of view, there is two ones which should be used : SP RAD Studio, which will be available next month and Event handler Explorer. You can do it from the following site: Event Handler Explorer.

    Why should we use this kind of tool? The objective is to check that event handler is attached to document librairy or list we want.

    Event Handler Explorer is easy to use but here is a quick overview of the tool:

    When program is loaded, all controls are blank. You have to indicate what is the site collection url.

    5

    As soon as you did it, you can navigate through the complete site collection and select the list or the document library you want.

    6

    After this, click on Event Handlers. If there is some attached event handlers, they will be listed beside this node.

    4

    By selecting an event handler, you can get more information about it on the right panel.

    3 

    It is also possible to attach or detach event handlers through this interface.

    SharePoint logs usage

    Errors that are not handled in an event handler is logged in the SharePoint file log. All the files (by defaut, there is one every 30 minutes) are located in the folder c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS if you let default parameters during installation.

    Search in the files for the class name, Company.SharePoint.EventHandlers.EventHandlerName for example so you will be able to see if there was an error or not. This kind of error will look like:

    02/25/2009 21:14:39.61 w3wp.exe (0x0C04)                       0x04DC Windows SharePoint Services   General                                8e0c                Critical   Event manager error: Could not load file or assembly 'Company.SharePoint.EventHandlers.EventHandlerName , Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5' or one of its dependencies. The system cannot find the file specified.            

    If you are using Microsoft Office SharePoint Server 2007, you can directly write information in these logs. You have to add a reference to Microsoft.Office.Server.dll DLL located in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\ folder. Then, in your code, add the following instruction: Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“your text”);

    Visual Studio debugging

    Some processes are required to run SharePoint. One of them is used to manage and render web pages in the browser. In fact, this process is used by all ASP.NET applications and SharePoint is based on ASP.NET. So if we want to see what happens in our code, we have to attach the debugger to w3wp.exe process.To attach the debugger, go to Visual Studio and select Attach to a process… in the Debug menu.2

    Maybe you will find more than one w3wp process. If true, you can attach the debugger to all the instances of the process.

    Select all the w3wp instance by holding CTRL during selection.

    1 

    If you haven’t any w3wp process, go to your browser and open a SharePoint url so the w3wp will start to run. Then click on Refresh button and select the newly process.

    Now you have your debugger attached to your event handler. You just have to add some breakpoints and run debugger step by step. There is a lot of features provided by Visual Studio, do not hesitate to use them (Debugging in Visual Studio)!

  • SharePoint: How to set an URL column using code?

    It is not a trick but it can be useful for a lot of developpers. The opertaion is easy but way to assign the field can divert from what you are expecting.

    item["myfield"].Value = "http://myserver.com, description string";
More Posts Next page »
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