vendredi 27 juin 2014

SharePoint 2013 + AjaxControlToolkit 4.5 intégration dans votre solution Visual Studio

De quoi parle-t-on ? 

ASP.NET AJAX Control Toolkit est un projet open-source intégré au framework Microsoft ASP.NET AJAX. Il s'agit d'un effort conjoint entre Microsoft et la communauté ASP.NET AJAX qui fournit une infrastructure puissante pour écrire des composants réutilisables, personnalisables et extensibles ASP.NET AJAX et des contrôles, ainsi que d'un riche éventail de contrôles qui peuvent être utilisé out-of-the-box pour créer une expérience Web interactive.

L'AJAX Control Toolkit contient plus de 30 contrôles qui vous permettent de créer facilement des pages  Web interactives riches.

La liste complète des contrôles disponibles se trouve sur cette page: http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/Default.aspx

Intégration à une solution SharePoint 2013 sur Visual Studio 2012

A. Premièrement il vous faudra télécharger la version correspondant au framework .NET 4.5 à l'adresse suivante sur la plateforme CodePlex: 
Dézipper finalement l'archive sur votre serveur pour pouvoir ensuite référencer les dlls.

B. Nous allons maintenant référencer les dlls suivantes dans le projet Visual studio :
  • AjaxControlToolkit.dll
  • AjaxMin.dll
C. Ajout des SafeControls à la solution: dans le dossier "Package" de votre solution cliquez sur le fichier Package.package pour le modifier, puis allez dans l'onglet "Advanced"


Cliquez sur Add puis sur "Add existing assembly", sélectionnez la dll  AjaxControlToolKit depuis un sous-dossier de votre solution 
  • Name space :AjaxControlToolkit
  • TypeName : *
  • Assembly : AjaxControlToolkit, Version=4.5.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e
Effectuez la même manipulation avec le fichier AjaxMin.dll

  • NameSpace: AjaxMin.dll
  • TypeName: *
  • Assembly : AjaxMin, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f




D.Ajoutez ensuite dans le fichier web.config de votre WebApplication situez sous le répertoire  "C:\inetpub\wwwroot\wss\VirtualDirectories\[Your web application Port]"  une référence à l'assembly référencé ou encore passez par une feature de scope Web  Application avec l'event receiver suivant pour effectuer la modification automatiquement:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;

            var configModAssembly = new SPWebConfigModification
            {
                Name = "add[@assembly=\"AjaxControlToolkit, Version=4.5.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e\"]",
                Owner = "AjaxControlToolkitWebConfig",
                Path = "configuration/system.web/compilation/assemblies",
                Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode,
                Value = "<add assembly=\"AjaxControlToolkit, Version=4.5.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e\" />"

            };

            var configModAssembly2 = new SPWebConfigModification
            {
                Name = "add[@assembly=\"AjaxMin, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f\"]",
                Owner = "AjaxControlToolkitWebConfig",
                Path = "configuration/system.web/compilation/assemblies",
                Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode,
                Value = "<add assembly=\"AjaxMin, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f\" />"
            };

            webApp.WebConfigModifications.Add(configModAssembly);
            webApp.WebConfigModifications.Add(configModAssembly2);

            /*Call Update and ApplyWebConfigModifications to save changes*/
            SPWebService.ContentService.WebApplications[webApp.Id].WebConfigModifications.Add(configModAssembly);
            SPWebService.ContentService.WebApplications[webApp.Id].WebConfigModifications.Add(configModAssembly2);
            SPWebService.ContentService.WebApplications[webApp.Id].Update();
            SPWebService.ContentService.WebApplications[webApp.Id].WebService.ApplyWebConfigModifications();
        }

E.Déplacez la section suivante de votre fichier master .html depuis la balise head vers la balise body.

après:

Ajoutez également une référence dans votre masterpage avec la ligne suivante:

<%@Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.5.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>


Vous êtes maintenant prêt à utiliser les contrôles AjaxControlToolKit au sein de vos webparts.


lundi 23 juin 2014

Design : Sharepoint Palette tool 2013

Ami designer en herbe, Microsoft dispose d'un programme vous permettant de créer et de modifier les fichiers spColor qui constitue la partie thème de SharePoint.

Grâce à cette outil il est possible de générer automatiquement le fichier permettant de customizer votre portail en quelques clics.


Il ne reste plus qu'ensuite à importer le fichier grâce à SharePoint Designer dans le dossier

/_catalogs/theme/15 de votre site SharePoint Online ou SharePoint 2013


Et à modifier le thème de votre site via la page de modification d'apparence.

http://www.microsoft.com/en-us/download/details.aspx?id=38182

lundi 31 mars 2014

Google hire pokemon Master

Be hired by Google by collecting every pokemon on earth

http://www.journaldugeek.com/2014/04/01/pokemon-collectionnez-tous-google/

#Poissondavril

vendredi 21 mars 2014

Pivot viewer overview

Silverlight pivot viewer overview : http://tonychampion.net/blog/index.php/2012/01/12th-day-of-silverlight-pivotviewer/
How to add custom action to  silverlight pivot viewer: http://tonychampion.net/blog/index.php/2012/01/pivotviewer-basics-basic-item-adorners/
Deal with silverlight pivot viewer semantic zoom : http://tonychampion.net/blog/index.php/2011/11/pivotviewer-basics-semantic-zoom/

mardi 28 janvier 2014

Troubleshoot user profil Synchronization SharePoint 2013 : Profil sync step InvalidOperationException : stopped-connectivity


If you decide to enable user profile synchronisation you may encounter the following error when trying to launch a full synchro.



"Profile sync step DOMAIN (stage ActiveDirectoryFullImport) failed: System.InvalidOperationException: stopped-connectivity "



The related error in Event log is the following

Management Agent run profile : The management agent "MOSSAD-DOMAIN" failed on run profile "DS_FULLIMPORT" because of connectivity issues.

Additional Information

Discovery Errors : "0"

Synchronization Errors : "0"

Metaverse Retry Errors : "0"

Export Errors : "0"

Warnings : "0"


User Action

View the management agent run history for détails.








 

In SharePoint 2013 you can access to all user profil synchronization log with the following tool :


C:\Program Files\Microsoft Office Servers\15.0\Synchronization Service\UIShell\miisclient.exe



vendredi 27 décembre 2013

Sharepoint Error: Save Conflict Your changes conflict with those made concurrently by another user

If you develop Sharepoint components that modify list items, you might know this error:
Save Conflict
Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.
This happens whenever you try to save a SPListItem which has been modified since you opened it. Review your code to ensure that you don’t open the same list item multiple times, work with a single SPListItem object instead.
Sometimes however it is necessary to open the same list item in parallel, as example if you want to perform an operation with elevated privileges on the item. If you take this approach you need to ensure that if you save one of the SPListItem objects, you need to reload all other SPListItems that point to the same actual item. Otherwise you’ll get the error above whenever you perform a change on the outdated items.
You can use the following utility method to ease the reloading of items:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// <summary>
/// Reload a list item from scratch
/// </summary>
/// <param name="item">The list item</param>
/// <remarks>
/// Useful to avoid save conflicts
/// </remarks>
/// <returns></returns>
public static SPListItem ReloadListItem(SPListItem item)
{
    if (item == null)
        return null;
 
    return item.ParentList.GetItemByUniqueId(item.UniqueId);
}

vendredi 13 décembre 2013

SharePoint 2010 / 2013 Get all groups for SPUser including active directory group

SharePoint don't give you groups for SPUser if the right is given by an active directory group.

You have to merge groups specificied directly using user login in sharepoint groups and active directory groups.


private static List<SPGroup> GetAllUserGroups(SPUser user)
{
    List<SPGroup> groups = new List<SPGroup>();
    //Get groups from SharePoint
    foreach (SPGroup spGroup in user.Groups)
    {
        groups.Add(spGroup);
    }
    string userLogin = user.LoginName;