lundi 13 mai 2013

Change SPWeb Properties, CreateFriendlyUrlsForNewPages and CreateFriendlyUrlsForNewPages for SharePoint 2013 Navigation

Use the following Powershell in order to change the behavior of the managed navigation when you create a new page. Replace whether by true or false in order to fit the needs.


Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$site = Get-SPSite $siteUrl;

$site.AllWebs | foreach {

$webNav = $_.Properties["_webnavigationsettings"];
$webNav ;

#Replace  AddNewPagesToNavigation="True"  and  CreateFriendlyUrlsForNewPages="True" 


$webNav = $webNav.Replace('AddNewPagesToNavigation="True"','AddNewPagesToNavigation="False"');
$webNav = $webNav.Replace('CreateFriendlyUrlsForNewPages="True"','CreateFriendlyUrlsForNewPages="False"');
$_.Properties["_webnavigationsettings"] = $webNav;
$_.Properties.Update();
$_.Update();
}



lundi 29 avril 2013

Cache et perfomances SharePoint 2013

Plan for caching and performance in SharePoint Server 2013

Learn about the BLOB cache, Bit Rate Throttling, and other SharePoint features that can improve browser performance.

For a publishing site for which most of the visitors are anonymous or where most of the files are static content, enable the BLOB cache for as many file types as possible.

Using BLOB cache in a high traffic environment, and if you will use ULS logging, consider placing the BLOB cache on a separate physical drive from the ULS log — not on a separate partition. Storing the BLOB cache and the ULS log on the same drive can result in poor server performance.

Each front-end web server has its own local copy of the BLOB cache that is built as requests for files are received. If you use load balancing with multiple front-end web servers, each server contains its own cache.

By default, the BLOB cache is set to 10 gigabytes (GB). Allow at least 20 percent more space on the drive than the size of the cache. For example, if you have 100 GB of content, set the size of the cache to 120 GB on a drive that has at least 150 GB of space. If the BLOB cache is too small, serving files to users slows, reducing the performance of your site.

http://technet.microsoft.com/en-us/library/ee424404.aspx

Cache settings operations in SharePoint Server 2013

Learn about the available caches and the settings that can be configured for the BLOB cache, cache profiles and object cache settings.

http://technet.microsoft.com/en-us/library/cc261797.aspx

Monitor cache performance in SharePoint 2013

Learn how to monitor the SharePoint BLOB cache, the ASP.NET output cache, and the SharePoint object cache.

http://technet.microsoft.com/en-us/library/ff934623.aspx

Configure cache settings for a web application in SharePoint Server 2013

Learn how to configure the BLOB cache, page output cache profiles, and the object cache for a web application.

http://technet.microsoft.com/en-us/library/cc770229.aspx

Create a Data Collector Set to Monitor Performance Counters

You can create a custom Data Collector Set containing performance counters and configure alert activities based on the performance counters exceeding or dropping below limits you define.

http://technet.microsoft.com/en-us/library/cc722414.aspx

mardi 23 avril 2013

Premiers pas sur Office 365 et SharePoint 2013 Online

Création de votre site

Une offre d'essai permet de créer un compte sur Office 365 pendant 30 jours, tout ce qu'il vous suffit c'est une adresse mail Microsoft (hotmail /outlook /live).

http://msdn.microsoft.com/fr-fr/library/fp179924.aspx#o365_signup



Une fois votre compte créé il ne reste plus qu'à vous rendre sur votre portail avec le compte créé ( @onmicrosoft.com)



Votre première application

Commençons par nous rendre sur l'administration SharePoint


Rendez-vous ensuite sur la première collection de sites SharePoint 2013 online créée par défaut dont l'URL est https://angama.sharepoint.com dans mon cas puisque mon domaine est 'angama'

Vous voici donc sur votre site SharePoint 2013 dédié au développement d'application.

Nous allons nous intéresser en premier lieu à l'ajout d'application à votre portail et plus particulièrement aux liste de tâches.
Dans la partie paramètres située en haut à droite de votre site cliquez sur "Ajouter une application".


Une fois dans la galerie des applications, cliquez sur le modèle de liste "Tâches" et nommez votre liste "Planning".


Une fois la liste créée vous vous retrouvez sur la page "Contenu de site" avec la liste "Planning" correctement créée.
La prochaine étape consistera à populer cette liste et modifier l'affichage de celle-ci.

Ajoutez du contenu à la liste en vous servant du formulaire d'ajout et ajoutez les tâches à la vue chronologique.


Nous allons maintenant ajouter cette vue à la page principale de notre site, revenez à la page d'accueil du site en cliquant sur le logo SharePoint 2013 en haut à gauche de la page.

Cliquez ensuite sur "Page" et enfin sur "Modifer la page".


 Depuis l'onglet "Insérer" cliquez sur "Composant WebPart", il vous suffit maintenant de chercher l'application correspondant à la liste "Planning" et de l'ajouter à la page.

Voici le résultat final en ajoutant à gauche la WebPart Planning et sur la droite cette même WebPart en filtrant les résultats sur "Mes tâches".


Libre à vous de modifier l'affichage de la page notamment en changeant le thème de votre de site et en le renommant.

Le prochain tutoriel portera sur la navigation grâce au magasin des termes, les URL conviviales et le SEO (search engine optimization).

vendredi 1 mars 2013

Modify Site Collection URL SharePoint 2010

In order to rename a Site collection in SharePoint 2010 you need to backup the site first and restore it on an new Site collection.
To do that you can use the following PowerShell :
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 
  
#Get the Source Site Collection URL
$sourceURL = Read-Host “Enter the Source Site Collection URL:”
  
#Get the Target Site Collection URL
$targetURL = Read-Host “Enter the Destination Site Collection URL”
  
#Location for the backup file 
$backupPath = Read-Host “Enter the Backup File name & location (E.g. c:\temp\Source.bak):”
  
#Backup the source site collection
Backup-SPSite $sourceURL -Path $backupPath -force
  
#Delete source Site Collection 
Remove-SPSite -Identity $sourceURL -Confirm:$false
  
#Restore Site Collection to new URL
Restore-SPSite $targetURL -Path $backupPath -Confirm:$false
  
#Remove backup files
Remove-Item $backupPath
  
write-host "Process Completed!"


vendredi 15 février 2013

Windows 8 : Open a local file and read Xml content

Thanks to this tutorial you will learn how to open an Xml File located in you Solution Explorer and how to retrieve value.

We will use Linq on Xml file so you have to add the following  librairies to your projet :


using System.Xml.Linq;
using Windows.Data.Xml.Dom;
using Windows.Storage;


Add a folder named 'Data' for exemple into you Windows Store solution and add the following Xml content into the file 'Schools.xml':

<?xml version="1.0" encoding="utf-8" ?>
<school>
  <name>IUT Toulouse</name>
  <type>Public</type>
  <location>
    <X>45.1</X>
    <Y>32.5</Y>
  </location>
</school>

And into a EventHandler or in the Page_Load for example add the folowing code :

Windows.Storage.StorageFolder storageFolder =await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Data"); StorageFile storageFile =await storageFolder.GetFileAsync("Schools.xml"); IAsyncOperation<IRandomAccessStream> stream = await storageFile.OpenAsync(FileAccessMode.Read); XmlDocument xmlDoc = await XmlDocument.LoadFromFileAsync(storageFile); XDocument doc = XDocument.Parse(xmlDoc.GetXml()); string name = from schools in doc.Descendants("name") select schools.Value;string type = from schools in doc.Descendants("type") select schools.Value;

At the end of the code the variables  name and type contains the value retrieve in the xml file.





jeudi 7 février 2013

Windows 8 par où commencer ?

Voici quelques liens qui peuvent vous aidez à prendre en main windows 8 aussi bien niveau usage que développement :


Le top 10 des App :
http://www.pcworld.com/article/2012988/10-windows-8-apps-you-should-download-first.html


Génération App Microsoft avec les offres en cours et les concours:
http://www.generationapp.com/code/#fbid=FcBScBurfJr


Vos ressources de développement avec Microsoft code pour windowsApp:
http://code.msdn.microsoft.com/windowsapps

Comment concevoir vos applications et les rendre #1:
http://msdn.microsoft.com/library/windows/apps/hh779072/


Utilisation de la barre d'application suivant le context:
http://blogs.msdn.com/b/windowsappdev/archive/2012/09/06/embracing-ui-on-demand-with-the-app-bar.aspx

mercredi 30 janvier 2013

How to log directly into EventLog server (Observateurs d'événements)

Every application can write into the server event log diary thanks to a C# class called "System.Diagnostics.EventLog"

In order to log message you have to instanciate one object of this class and specify two important elements Source and Log

Log will define the category in which your message will appear, you can use 'Application' 'Security' 'Installation' and so on.

Source define the name of the application that log the message, you can use your application name for example.


And the C# code to log into the diary event :


private static string SourceLog = "MyApplicationName";
private static string LogApp = "Application";
private static System.Diagnostics.EventLog eventLogApplication;

/// <summary>
/// Log the message into the Windows event log diary
/// </summary>
/// <param name="message">Message</param>
static void Log( string message )
{
     Log( message, System.Diagnostics.EventLogEntryType.Information );
}

/// <summary>
/// Log the message into the Windows event log diary
/// </summary>
/// <param name="message">Message enregistré</param>
/// /// <param name="entryType">Entry type</param>
static void Log( string message, System.Diagnostics.EventLogEntryType entryType )
{
     try
     {
          //Initialisation
          if (!System.Diagnostics.EventLog.SourceExists(SourceLog))
         {
              System.Diagnostics.EventLog.CreateEventSource(SourceLog, LogApp);
         }
         if (eventLogApplication == null)
        {
             eventLogApplication = new System.Diagnostics.EventLog();
             ((System.ComponentModel.ISupportInitialize)(eventLogApplication)).BeginInit();
             eventLogApplication.Source = SourceLog;
              eventLogApplication.Log = LogApp;
        }

        //Writing
        eventLogApplication.WriteEntry(message, entryType);
   }
    catch (Exception e)
    {
        Log("Error Log : " + e.InnerException + " " + e.Message, EventLogEntryType.Error);
      }
}

lundi 28 janvier 2013

BeMyApp dev kings 2013

L'initiative BeMyApp continue son petit bonhomme de chemin et propose un nouveau défi pour les fan de développement :

http://pitchyourapp.eventbrite.fr/

Source : BeMyApp.fr

DEV KINGS 2013 - On remet ça !
Edition spéciale app'citoyenne

Venez développer vos applications citoyennes et participez au concours des DEV KINGS 2013.
Choisissez la localité à représenter, créez votre team et développez vos app' !


2 MOIS POUR DEVELOPPER LA MEILLEURE APP'CITOYENNE
Le 12 février
Soirée Pitch Your App, lancement du concours. Pitchez vos idées, rencontrez votre équipe de développeurs, porteurs d'idées, designers et autres super pouvoirs.

Du 12 février au 12 avril
Sessions de coaching Microsoft, développez à l'aide des experts Microsoft vos applications en deux mois.

Weekend du 12 au 14 avril
DEV KINGS 2013inscrivez-vous et venez terminer vos applications avec vos équipes en 48h ! Participez à la grande finale, soumettez vos applications sur Windows Store et passez un WeekEnd de folie dans l'Under d'EPITECH.


INSCRIVEZ-VOUS ICI A LA SOIREE PITCH YOUR APP
Mardi 12 février Chez Régine, venez créer votre équipe à la soirée Pitch Your App

Le but de cette soirée est de mettre en relation des personnes qui ont des idées d'applications, des développeurs et des designers pour créer des applications citoyennes sous Windows 8 et Windows Phone.
Vous avez une super idée d'application, mais pas les compétences, c'est le moment de vous inscrire pour la pitcher et trouver votre team. 
Vous êtes développeurs, designers ou avez des compétences à apporter ? Alors participez au challenge pour rejoindre une équipe, trouvez des compétences complémentaires pour vos applis et gagnez des dotations Microsoft et Intel !

SharePoint 2013 : Log as an other user, add the custom action

Please follow the following step in order to activate the option 'Log as an other user'.

Open the file located in


C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES\Welcome.ascx

Add the following lines after the element « ID_RequestAccess » :

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
 Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
 MenuGroupId="100"
 Sequence="100"
 UseShortId="true"
 />
















And save the file.

You can now do a 'iisreset' and see the result as :


http://support.microsoft.com/kb/2752600


jeudi 24 janvier 2013

Sort DataTable DataView ascending with null or empty last.


You first need to specify the sorting column in 'param' and replace the original DataTable by 'collection'.

In this example I filter a DataTable with the SelectedValue given by my DropDownList control (ddlFiltre).

In the DataRow array 'nameNotNull' I simply simply the data that are not null for my parameter and sort them.
And in the DataRow array 'nameNull' I select the null data for my parameter.

You just need to merge the two DataRow array and bind it with the GridView

DataTable collection;
//Fill the dataTable
//...
///

protected void ddlFiltre_Change(object sender, EventArgs e){ 
  if (!string.IsNullOrEmpty(ddlFiltre.SelectedValue)) {   
       string param = "Name";
       DataRow[] nameNotNull = collection.Select(string.Format("{0} IS NOT NULL AND {0} <> ''", param),string.Format("{0} ASC", param));
       DataRow[] nameNull = collection.Select(string.Format("{0} IS NULL OR {0} = ''", param));
        DataTable collectionSorted = collection.Clone();
   if (nameNotNull.Length > 0)
   {
      foreach (DataRow dr in nameNotNull)
      {
         DataRow newRow = collectionSorted.NewRow();
         newRow.ItemArray = dr.ItemArray;
         collectionSorted.Rows.Add(newRow);
      }
      if (nameNull.Length > 0)
      {
         foreach (DataRow dr in nameNull)
         {
            DataRow newRow = collectionSorted.NewRow();
            newRow.ItemArray = dr.ItemArray;
            collectionSorted.Rows.Add(newRow);
         }
       }
    }
    else if (nameNull.Length > 0)
    {
       foreach (DataRow dr in nameNull)
       {
          DataRow newRow = collectionSorted.NewRow();
          newRow.ItemArray = dr.ItemArray;
          collectionSorted.Rows.Add(newRow);
       }
    }
    gvItems.DataSource = collectionSorted;
    gvItems.DataBind();
}
}

jeudi 10 janvier 2013

Modifier les pages SharePoint par défaut. (AccessDenied.aspx, Confirmation.aspx, Error.aspx, Login.aspx, RequestAccess.aspx, Signout.aspx, WebDeleted.aspx)

Il est possible d'avoir de modifier l'url des pages suivantes et de les surcharger pour intégrer le design de l'entreprise :
  •  AccessDenied (Specifies AccessDenied.aspx)
  •  Confirmation (Specifies Confirmation.aspx)
  •  Error (Specifies Error.aspx)
  •  Login (Specifies Login.aspx)
  •  RequestAccess (Specifies ReqAcc.aspx)
  •  Signout (Specifies SignOut.aspx)
  •  WebDeleted (Specifies WebDeleted.aspx)
Avec les classes correspondantes se trouvant dans le namespace : 


Microsoft.SharePoint.ApplicationPages



Il est aussi nécéssaire de modifier la masterpage de votre page d'application par :

MasterPageFile="~/_layouts/simple.master"

Et d'hériter la classe correspondante 

UnsecuredLayoutsPageBase pour AccessDenied.aspx par exemple.




La modification de ces pages peut ensuite se faire de deux manières, soit par code C# :

SPWebApplication.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, 

"_layouts/MyAccessDenied.aspx);


Soit via powershell : 


Set-SPCustomLayoutsPage -Identity "AccessDenied" -RelativePath 

"/_layouts/MyAccessDenied.aspx" -WebApplication http://serveur 

Get-SPCustomLayoutsPage –Identity "AccessDenied" -WebApplication http://serveur 

iisreset


Voici une page complète d'une customisation simple de la page AccessDenied.aspx avec changement du lien 'Retour au site' par défaut : 



<%@ Assembly Name="Name, Version=1.0.0.0, Culture=neutral,PublicKeyToken=092c1c010b5e2820" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccessDenied.aspx.cs" Inherits="AccessDenied" MasterPageFile="~/_layouts/simple.master" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Publishing" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.CurrentUser != null)
        {
            LabelUserName.Text = SPContext.Current.Web.CurrentUser.LoginName;
        }
     
        if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.Site != null
            && SPContext.Current.Web.Site.WebApplication != null)
        {
         
            Page.ClientScript.RegisterStartupScript(this.GetType(), "click",
        "modifierRetour('" + SPContext.Current.Web.Site.WebApplication.Sites[0].Url + "');", true);
        }


   //     HLinkLoginAsAnother.Attributes.Add("onclick", "LoginAsAnother('\u002fsites\u002factuariat\u002f_layouts\u002fcloseConnection.aspx?loginasanotheruser=true', 1)");
    //    HLinkLoginAsAnother.NavigateUrl = "http://www.google.com/";
    }
    </script>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <style type="text/css"></style>
    <script type="text/javascript">
        function modifierRetour() {
            var backbutton = document.getElementById('ctl00_PlaceHolderGoBackLink_idSimpleGoBackToHome');

            if (backbutton != null) {
                backbutton.href = "javascript:history.back()"; // cacherBackToSite.arguments[0];
            }
        }
</script>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
 
   <table border="0" cellpadding="0">
         <asp:Panel id="PanelUserName" runat="server">
         <tr>
       <td class="ms-sectionheader">
       <%--<img src="/_layouts/images/ListSet.gif" alt="" />--%>
       <SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" text="<%$Resources:wss,accessDenied_currentuser%>" EncodeMethod='HtmlEncode'/>
       </td>
         </tr>
         <tr>
       <td valign="top" class="ms-descriptiontext"><SharePoint:EncodedLiteral ID="EncodedLiteral4" runat="server" text="<%$Resources:wss,accessDenied_loggedInAs%>" EncodeMethod='HtmlEncode'/>
       &#160;<b><asp:Label id="LabelUserName" runat="server"/></b>
       </td>
         </tr>
         </asp:Panel>
    </table>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
 <SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="Accès refusé au site demandé" EncodeMethod='HtmlEncode'/>
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    <SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" text="Vous n'avez pas le droit de visualiser ce site." EncodeMethod='HtmlEncode'/>
</asp:Content>


 


















vendredi 14 décembre 2012

How to activate custom action based on SharePoint Right

This javascript function is a helper to enable or disable custom action for SharePoint 2010 based on ContentTypeID, Permissions and number of selected element.

You can call this function in the CommandUIHandler EnabledScript attribute

Create a custom action for Ribbon :

  <CustomAction Id="Ribbon.AlertPerso"
              RegistrationType="ContentType"
                 RegistrationId="0x0101002D02DF72FAFB4EAB9446F92337C759AE01"
              Location="CommandUI.Ribbon" Title="Alert Perso">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
          <Button Id="Ribbon.CreerAlerter.Button"
                  LabelText="Créer une alerte personnalisée"
                  TemplateAlias="o2"
                  Image16by16="/_layouts/images/avertir16.png"
                  Image32by32="/_layouts/images/avertir32.png"
                  Sequence="08"
                  Command="AlerteCommandeDoc" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="AlerteCommandeDoc"
                          CommandAction="javascript:window.location='votre page cible."
<!-- Replace the first attribute by you content type id, the second one with the SPPermission needed, and the thrid with the number of element that have to be selected (list of sharepoint permission kind : http://msdn.microsoft.com/en-us/library/ee556747(v=office.14).aspx) -->            EnabledScript="javascript:ActiveTypeContenuDroit('0x0101002D02DF72FAFB4EAB9446F92337C759AE01',SP.PermissionKind.,1);"/>
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>




Ajout de la fonction dans core.js :

//Id of SP.ListItem
var ItemSelectedID;
//Content Type ID
var ItemSelectedContentType;
//SP.ListItem
var ItemSelectedItem;
//Right on the item.
var ItemSelectedRight;

//Check if the custom action is enabled

//ContenuID : Content Type Id that the item must match.
//Permission : Permissions needed, if null the custom action will be enabled.
function ActiveTypeContenuDroit(ContenuID, Permission, TypeAction) {
    var result = false;
    var selectedItems = SP.ListOperation.Selection.getSelectedItems();
    var countItems = CountDictionary(selectedItems);

    //when the action is available for all items.
    if (TypeAction == 0 && countItems == TypeAction) {
        result = true;
    } else {
        //when the action is available when only one item is selected.
        if (countItems == TypeAction && TypeAction == 1) {
            //when the objet is not defined
            if (this.ItemSelectedID == null) {
                var listGuid = SP.ListOperation.Selection.getSelectedList();
                ItemSelectedID = selectedItems[0]['id'];
                ListItemContentTypePermission(this.ItemSelectedID, listGuid);
            }
            //when the charged item is not previous item that was charged
            else if (this.ItemSelectedID != selectedItems[0]['id']) {
                this.ItemSelectedID = selectedItems[0]['id'];
                var listGuid = SP.ListOperation.Selection.getSelectedList();
                ListItemContentTypePermission(this.ItemSelectedID, listGuid);
            }
            //compare with the content type id parameter
            else if (this.ItemSelectedContentType != null) {
                if (ItemSelectedContentType.toString().indexOf(ContenuID.toString()) != -1) {
                    //Check rigth on the object.
                    if (Permission != null && ItemSelectedRight != null) {
                        if (ItemSelectedRight == null) {
                            alert("ItemSelectedRight null");
                        }
                        else {
                            //Check rigth on the object.
                            var permettre = ItemSelectedRight.has(Permission);
                            if (permettre) {
                                { result = true; }
                            }
                        }
                    }
                    else {
                        result = true;
                    }
                }
            }
        }
        else {
            //when more than one selected value is possible
            if (TypeAction > 1) {
                    // .. action when two item selected.
                alert("not defined ActiveTypeContenuDroit " + TypeAction);
                result = false;
            }
        }
    }
    return result;
}

//Initialize SP.ListItem and get the property  Title  ContentTypeId EffectiveBasePermissions
function ListItemContentTypePermission(ItemId, listGuid) {
    var clientContext = new SP.ClientContext();
    var web = clientContext.get_web();
    var lists = web.get_lists();
    var list = lists.getById(listGuid);
    ItemSelectedItem = list.getItemById(ItemId);
    clientContext.load(ItemSelectedItem, 'Title', 'ContentTypeId', 'EffectiveBasePermissions');
    clientContext.executeQueryAsync(onListItemContentTypePermission, failedListItemContentTypePermission);
}

//Get the needed property.
function onListItemContentTypePermission(sender, args) {
    ItemSelectedRight = ItemSelectedItem.get_effectiveBasePermissions();
    ItemSelectedContentType = ItemSelectedItem.get_item('ContentTypeId');
    RefreshCommandUI();
}

function failedListItemContentTypePermission(sender, args) {
    alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
}

SharePoint Client Side Object Model (CSOM)

Un petit coup de chapeau pour ce très bon post qui trait du CSOM dans SharePoint 2010, SharePoint 2007, SharePoint 2013.

Et notamment sur la récupération du SP.ClientContext< ainsi que le fonctionnement des executeQueryAsync

http://blog.aptillon.com/2012/09/25/the-sharepoint-javascript-object-modelresources-and-real-world-examples/

vendredi 23 novembre 2012

Soirée Intel et Microsft autour de Windows 8

Microsoft et Intel organisent une soirée au RedLigth ce jeudi 29 Novembre, cette soirée sera dédié aux ultrabooks ainsi qu'au développement d'application Windows 8 "AppTouch"

Des experts Microsoft et Intel seront là pour assurer le show et des stands de démo seront aussi présents pour essayer les dernières technos.

( cocktail / bière / pizza à volonté ) 

Programme de la soirée :

19h30 : Accueil des participants au Red Light & cocktails

19h45 :  Présentation de la Intel Developer Zone
Découvrez la gestion du tactile sous Windows 8 et les APIs natives/C#/HTML vous permettant d’en tirer partie L'accent sera mis sur le développement d'applications pour Ultrabook. 

20h :Guideline de User Interface sur Ultrabook
Formation technique au touch et aux outils de design d'interface pour Ultrabook. Guidelines sur le UI/UX sur Ultrabook.

20h45: Rencontre avec les Sensors
Découvrez toutes les API de Sensors qui sont mises à dispositon des développeurs.

21h30 : Drinks et Pizzas et Démos
Pendant toutes la soirée, vous pourrez profiter d'un espace démo et de coachs qui seront présents pour vous conseiller et répondre à toutes vos questions. 

Le récap de l'événement est ici : 
http://www.meetup.com/Intel-Technologies-Meetup/events/92504522/


Et l'inscription sur le site de intel :
http://applabintel.eventbrite.com/

mardi 20 novembre 2012

The HTTP service located is too busy / Le service HTTP est trop occupé



Pour provisionner un service trop occupé dans SharePoint 2010, exécuter les commande suivantes :

$sts = Get-SPServiceApplication | ?{$_ -match "nom du service"}  
$sts.Status
$sts.Provision()


Erreur sharepoint lié :
An exception occurred when trying to issue security token: Le service HTTP situé sur ../SecurityTokenServiceApplication/securitytoken.svc/actas est trop occupé.
Exception occured while connecting to WCF endpoint: System.ServiceModel.ServerTooBusyException


mardi 23 octobre 2012

Deactivate "I like" and "Notes" on ListItem for Sharepoint 2010 Ribbon / Désactiver les "J'aime ca" et "Notes" sur SharePoint 2010

Il suffit de désactiver la feature de ferme correspondante avec le code suivant :

Disable-SPFeature -id "756D8A58-4E24-4288-B981-65DC93F9C4E5" -force

Hide top navigation bar for Sharepoint 2010 / Cacher le ruban et la barre de navigation supérieur via code depuis la masterPage


Il ne faut pas oublier de passer les différents div en "runat='server'" pour que le code marche.

private void HideShowElement(bool value)
    {
        if(value) // Administrateur
    {    
    Control haut  = this.FindControl("msWwpselectlink");
//((HtmlControl)haut).Width="0px";
  ((HtmlControl)haut).Attributes.Add("style","display:block;");

Control hautLien  = this.FindControl("topNavgationBar");
  ((HtmlControl)hautLien).Attributes.Add("style","display:block;");


    Control crt = this.FindControl("PanelAdminLeft");
    if(crt!= null)
    {
    crt.Visible = true;
                //Supprime le css pour aligner à gauche.
                Control content = this.FindControl("MSO_ContentTable");
                if(content != null){
                ((HtmlControl)content).Attributes.Add("class","s4-ca s4-ca-dlgNoRibbon");}
    }
    }
    else  // Non administrateur
    {
    Control haut  = this.FindControl("msWwpselectlink");
// haut.Visible = false;
  ((HtmlControl)haut).Attributes.Add("style","display:none;");
  Control hautLien  = this.FindControl("topNavgationBar");
  ((HtmlControl)hautLien).Attributes.Add("style","display:none;");


    Control crt = this.FindControl("PanelAdminLeft");
    if(crt!= null)
    {
    crt.Visible = false;
                //Supprime le css pour aligner à gauche.
                Control content = this.FindControl("MSO_ContentTable");
                if(content != null){
                ((HtmlControl)content).Attributes.Remove("class");}
            }
    }
    }

Hide button in sharepoint 2010 Ribbon / Cacher les boutons du ruban SharePoint 2010


Feature à appliquer sur un type de contenu / template de liste par exemple.

Il suffit ensuite de spécifier la localisation du bouton.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <CustomAction Id="HideCustomActionDocumentSource"
                Location="CommandUI.Ribbon"
                RegistrationType="ContentType"
                RegistrationId="0x0101002D02DF72FAFB4EAB9446F92337C759AE01">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Library.ViewFormat.Standard" />
        <CommandUIDefinition Location="Ribbon.Library.ViewFormat.Datasheet" />

        <CommandUIDefinition Location="Ribbon.Library.Datasheet.NewRow" />
        <CommandUIDefinition Location="Ribbon.Library.Datasheet.ShowTaskPane" />
        <CommandUIDefinition Location="Ribbon.Library.Datasheet.ShowTotals" />
        <CommandUIDefinition Location="Ribbon.Library.Datasheet.RefreshData" />

        <CommandUIDefinition Location="Ribbon.Library.CustomViews.CreateView" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.ModifyView" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.CreateColumn" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.NavigateUp" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.CurrentView" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.DisplayView" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.PreviousPage" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.CurrentPage" />
        <CommandUIDefinition Location="Ribbon.Library.CustomViews.NextPage" />

        <CommandUIDefinition Location="Ribbon.Library.Share.AlertMe" />
        <CommandUIDefinition Location="Ribbon.Library.Share.ViewRSSFeed" />

        <CommandUIDefinition Location="Ribbon.Library.Actions.TakeOfflineToClient" />
        <CommandUIDefinition Location="Ribbon.Library.Actions.ConnectToClient" />
        <CommandUIDefinition Location="Ribbon.Library.Actions.ExportToSpreadsheet" />
        <CommandUIDefinition Location="Ribbon.Library.Actions.OpenWithExplorer" />
        <CommandUIDefinition Location="Ribbon.Library.Actions.AllMeetings" />

        <CommandUIDefinition Location="Ribbon.Library.CustomizeLibrary.AddButton" />
        <CommandUIDefinition Location="Ribbon.Library.CustomizeLibrary.EditList" />
        <CommandUIDefinition Location="Ribbon.Library.CustomizeLibrary.EditDefaultForms" />

        <CommandUIDefinition Location="Ribbon.Library.Settings.ManageWorkflows" />
        <CommandUIDefinition Location="Ribbon.Library.Settings.LibraryPermissions" />

        <CommandUIDefinition Location="Ribbon.Documents.New.NewFolder" />
        <CommandUIDefinition Location="Ribbon.ListItem.New.NewFolder" />
     
        <CommandUIDefinition Location="Ribbon.Documents.New.NewDocument" />
        <CommandUIDefinition Location="Ribbon.Documents.EditCheckout.CheckOut" />
        <CommandUIDefinition Location="Ribbon.Documents.EditCheckout.CheckIn" />
        <CommandUIDefinition Location="Ribbon.Documents.EditCheckout.DiscardCheckOut" />
 
        <CommandUIDefinition Location="Ribbon.Documents.Manage.ManagePermissions" />

        <CommandUIDefinition Location="Ribbon.Documents.Share.EmailItemLink" />
        <CommandUIDefinition Location="Ribbon.Documents.Share.AlertMe" />

        <CommandUIDefinition Location="Ribbon.Documents.Copies.SendTo" />
        <CommandUIDefinition Location="Ribbon.Documents.Copies.ManageCopies" />
        <CommandUIDefinition Location="Ribbon.Documents.Copies.GoToSourceItem" />
   
        <CommandUIDefinition Location="Ribbon.Documents.Workflow.ViewWorkflows" />
        <CommandUIDefinition Location="Ribbon.Documents.Workflow.Publish" />
        <CommandUIDefinition Location="Ribbon.Documents.Workflow.Unpublish" />
        <CommandUIDefinition Location="Ribbon.Documents.Workflow.Moderate" />
        <CommandUIDefinition Location="Ribbon.Documents.Workflow.CancelApproval" />
   
        <CommandUIDefinition Location="Ribbon.Documents.FormActions.RepairItems" />
        <CommandUIDefinition Location="Ribbon.Documents.FormActions.RepairAllItems" />
        <CommandUIDefinition Location="Ribbon.Documents.FormActions.MergeDocuments" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>


Liste complète
http://msdn.microsoft.com/en-us/library/ee537543.aspx



mercredi 17 octobre 2012

Pré-commande tablette Surface

Microsoft vient d'ouvrir la pré-commande pour la tablette surface, le stock serait de 3/4 millions pour le lancement.

Voici un récapitulatif des tarifs proposés :






Soit :
- Version 64GB avec la Touch Cover : 694€
- Version 32GB avec la Touch Cover : 589€
- Version 32GB sans la Touch Cover : 489€


http://www.microsoftstore.com/store/mseea/fr_FR/pdp/productID.257922600

vendredi 28 septembre 2012

Les teasers Windows Phone 8

HTCS 8S et HTCS 8X
<iframe width="560" height="315" src="http://www.youtube.com/embed/xapZwpLwUHI?list=PLGDJwi4NxPcjXfIapzhGFyA11Kopnx-VU&amp;hl=fr_FR" frameborder="0" allowfullscreen></iframe>

Nokia Lumia 820
<iframe width="560" height="315" src="http://www.youtube.com/embed/eBrfVp_olps" frameborder="0" allowfullscreen></iframe>


Nokia Lumia 920
<iframe width="560" height="315" src="http://www.youtube.com/embed/aYisb9p4ncA" frameborder="0" allowfullscreen></iframe>
http://youtu.be/aYisb9p4ncA

Samsung ATIV S
<iframe width="560" height="315" src="http://www.youtube.com/embed/PnabGFVlyqI" frameborder="0" allowfullscreen></iframe>

Un core Duo 1,8GHz pour la tablette Windows 8 d'entrée de gamme

C'est officialisé par Intel, le processeur équipant les premières version Windows RT sera un SoC (système on a chip), au programme :
-un core Duo 1,8Ghz
-une puce graphique PowerVR SGX permettant notamment l'affichage de vidéo full HD 1080p.

Tout ceci laisse présager un prix d'entrée avoisinant les 600$.