Thursday, March 2, 2017

Bye bye - English Blog... (Re)bonjour le français!

Hi all, 
it's been a while that I haven't published anything on this blog and that will sadly be the last time, I'm publishing something ... in english...

The reason is simple. 
In France, we have a really proud culture and our language is part of this pride. Our business is mainly done in French, and many people don't want or can't speak english. 

Studies have showed that a french person who don't speak perfectly english won't spend a lot of time to read an article in english UNLESS... he reallly needs it! 

My goals now, will really be to help the french market to rise on some problematic, I'm meeting in my professional life, and along with my role as a technical evangelist @ Nintex. I realize that there are not many serious articles on some topics in french, and that should be my role to fill the gap. Sharepoint, O365, workflow, processes, forms... eveything is going to be in french now :)

But you can still learn french, it will be easier that understanding a french who tries to speak english!


Thursday, February 26, 2015

Integrate AzureDataMarket API inside your Nintex workflow using JSON service.


Last week, I wanted to integrate more services in a demo Nintex workflow.There are a lot of services already existing, but obviously it was too easy to use what already exists. It is more fun to try to use what hasn't been done before!

Nintex Live Catalog

Nintex Live natively provide a huge set of actions (around 150 at this date) from a large range of services providers including:
  • Twitter
  • Facebook
  • Office 365
  • Sharepoint
  • Yammer
  • WordPress
  • DropBox
  • Bing services (Translate, search, directions…)
  • Docusign
  • Dynamics CRM
  • Salesforce
  • Google Drive
  • Linkedin
  • MailChimp
  • Azure
  • OneDrive
  • …
That usually fits most of your need. But what if you need more than that? What if you have identified a service somewhere that you have to consume that is not yet available on the Nintex Catalog?

User Defined Actions

To make the things simple, you will have to design your own UDA (User Defined Actions) on Nintex. The UDA are a super easy way of creating a packaged features based on simple Nintex set of actions.
Inside the Site Setting page of your site, under the Nintex Workflow menu, you will find the Manage User Defined Actions. From there you will be able to create your own.
You will be able to define input parameters and output parameters. The user who will use your action will only see those parameters and not the logic that is embedded inside.


 
Once you have created an UDA, you just have to publish it to your site. It will then be available to all your workflows (there is a section called User Defined Actions in your Nintex actions panel).
If you develop your UDA on your own development environment, you can export the entire UDA (it will generate an .uda file that you can reimport on another environment).
When you plan to create your UDAs, note that you can't have an UDA embedded in another UDA.
The UDA feature is actually only available on the On-Premise version of Nintex Workflow. Nevertheless, it will be available later this year for the O365 version.

 

Azure Marketplace

The Azure DataMarket's marketplace exposes data using Odata feeds. The Open Data Protocol (ODate) helps you unsiloting your data. On the platform you have access to hundreds of different services. What you need to access it? Just an account.
  1. Create an account on
    https://datamarket.azure.com/.
  2. Ok now you have an account, and what? Just parse all the possibility of the marketplace! But how to embed     those data and services in your Nintex workflow?
  3. Subscribe to a service or an application
  4. In the Azure Datamarket, find the application that suits you. You have application for everything.
  5. Register your application on the datamarket
Why would you need to register your application? Because you want to get some specific credentials for your application. You have two ways of authenticating your application HTTP basic/OAuth. In this case, we will use the OAuth. Llearn more: everything on the authentication and implement OAuth in your marketplace app.
From there, you will have to register your application using this link https://datamarket.azure.com/developer/applications, reaching the following page:


Registering your application will allow you to retrieve two really important information: ClientID and ClientSecret. They are the user/password to authenticate on the service. When authenticated you will retrieve your access_token that you will need for accessing the service itself.
Now you have everything to start!
You will find here https://msdn.microsoft.com/en-us/library/gg193414.aspx everything you need to know about the datasets queries on the market place.

 

Using JSON service on Nintex

From the previous chapter you have now your ClientID and ClientSecret, so now what should you do with it? Just call the authentication web service and retrieve your access_token!
That seems easy to do... The only problem is that Nintex "Web request" action doesn't handle the JSON! This is actually the entire topic of this article! Let's build a JSON parser inside an UDA!
This is how we gonna do it: 
  1. Build your workflow, and add a Web Request action into it.
    • The authentication service URL is : https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
    • No UserName/password
    • Content type: application/x-www-form-urlencoded
    • Header: grant_type=client_credentials&client_id={WorkflowVariable:ClientID}&client_secret={WorkflowVariable:ClientSecret}&scope=XXXXXXXXXXXXXXXXXX
    (in this case I admit that you have created 2 workflow cariables : ClientID and ClientSecret and that you have put the value to the value of your registered application)

        You will obtain something like :


    The problem is now you will have to handle the results in order to retrieve the access_token.


  2. For this example I have used the bing translation API. Here is what the answer will look like :

  3.  
    {"token_type":"http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0","access_token":"http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=XXXXXXXX&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&Audience=http%3a%2f%2fapi.microsofttranslator.com&ExpiresOn=1424878406&Issuer=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&HMACSHA256=WM6JE6HyhxZXV0ICcfaWVzDUIyEe78VuPnoN92HHIrY%3d","expires_in":"600","scope":"http://api.microsofttranslator.com"}

     The format of the JSON is {"key":"value","key2":"value2"}.
     


  4. I could have done it on a single UDA but the purpose of an UDA is to be reusable, and because there could be other usage for them, I have split in two separated UDA.

    • JSON_Stream_parser.uda : this one takes a stream as an input and provides as an output two collections : the keys, and the values
      Download the nwf file :
    • KeyCollection_search.uda : This one takes two collections in input (in our case they will be the output of the previous UDA) and a "KeyToFind" and will output the value. 
      Download the nwf file :
      Download the nwf file :


  5. From the last KeyCollection_search, I search access_token. When you get this you have to add "Bearer :" before the access_token (don't forget the spaces!) and then add it in the header of the webservice call as "authorization". In my Bing translation API case, I will call 
    http://api.microsofttranslator.com/v2/Http.svc/Translate?text=TextToTranslate&from=SourceLanguage&to=TargetLanguage and add an "Authorization" Header and set it with this access_token
  6.  Finally here is what the (simplified) version of the workflow looks like

     

     As a conclusion, I would just add that my example using Bing translation won't help you because , there is nativelly a Nintex action that allows you to translate using Bing!
    You should check on the Datamarket, there are plenty of examples that you will love to implement!

Wednesday, April 3, 2013

Office 365 - Site MailBox in replacement to Document Library incoming Mail?

I have to say that I have underestimated the site MailBox feature of Office 365.

As explained on the blog of Benoit Hamet http://blog.hametbenoit.info/Lists/Posts/Post.aspx?ID=484,this feature gives a lot of new capabilities, but it comes with its lot of missing features!

After having activating the web scoped feature "Site Mail Box", I have first been surprised in a wrong way by this feature :

It creates an exchange mail box that can be accessed via the interface and where all the members of your site can pick documents and mails. Isn't it great that only by activating a feature it creates you a exchange mail box for your site? After the excitment, come the questions..
With my local Sharepoint 2007-2010-2013 I can configure my library to receive emails and to store documents. With some mix of Rules/workflows/taxonomy/Item receivers I can even create a string redirection system. can I do that with MailBox? apparently no...
Apparently!

I have then configure my Outlook 2013 in order to get my personal Office365 emails offline. And looking inside the menus (I'm curious) I have found this item "Manage All site mailboxes" on the contextual menu of my personal mailbox. (sorry if I don't put screenshots, but mine is in french!)

The first time I clicked on it, nothing was displayed. The basic reason is that office 365 tries to see whether you are in the member/owner group of the site and if not it doesn't provide you the access to the mailbox (even if you are farm admin like I was). Second Try after having added me in the site owner group. The mail box is displayed and it comes up inside outlook with all the document libraries of the site!

You can apply outlook rules on this mail box! So basically, I can redirect whatever I want using those rules!

Play well!

Other sources :
http://blogs.technet.com/b/exchange/archive/2012/08/22/site-mailboxes-in-the-new-office.aspx
or/and (french)
http://spasipe.wordpress.com/2013/03/07/sharepoint-2013-les-site-mailboxes-14-configuration/
 

Monday, March 25, 2013

Create a new Community Template - Discussion/category Product bug

I'm actually working on a office 365 Social network project. Really interesting by the way.
I just lost two days believing that I had done something bad when I found on my newly created community (and actually all others) that the discussion board weren't linked correctly to my discussion board categories. Note that my community  template is not the basic one but a slightly customised one...

So, I have started everything again...  and again the same mistake...

So, I have tried a really basic test : I did the same test with the standard community template and I expected it to work, but there is the same problem with the standard template!
I tested it as well on my local environment the problem is exactly the same.Let's correct it!


  1. Open you newly created category.aspx page
  2. Open the two problematic webpart's property panel
  3. Change the view :
    1. for the proposed discussion webpart, set it to "Proposed discussion"
    2. for the other one, set it to "subject"
  4. From now, once you validate your page, you will have everything almost working, the only left problem is that you don't see the discussions according to the category of the page. let's continue.
  5. Open two instances of Sharepoint Designer 2013. One on the source site, and one on the target site. On both open category.aspx page
  6. On the target page, in all the xsltlistviewwebpart's parameterbinding, there is binding missing, you have to add it! 
  7. Almost at the end of page of your source page, locate the {CategoryID}, you will have to place it exactly at the same place on your target page.
  8. Save it.
  9. Test it & pray !


Thursday, November 22, 2012

Yammer For free with sharepoint Online

Announced at the Sharepoint conference 2012, and posted on the sharepoint Blog
http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=1049

"Beginning March 1, 2013, Yammer will be available to Microsoft Enterprise Agreement customers. Enterprise Agreement customers will be able to purchase Yammer Enterprise via Microsoft volume licensing. Microsoft has also created a set of combo SKUs for SharePoint Online (Plan 1 and Plan 2) + Yammer Enterprise. SharePoint Online + Yammer provides customers with a world-class collaboration platform and enterprise social capabilities.

Yammer Enterprise will also ship with Office 365 for enterprises (Office 365 E Plans 1–4). Office 365 customers will have rights to run Office 365 for access to email, calendars, Office Web Apps, instant messaging, and file sharing and will have Yammer Enterprise for social.

Along with shipping Yammer with some of our most popular services, we will also be lowering the price for Yammer Enterprise standalone. Yammer Enterprise standalone will be available for $3 per user/per month (vs. the original price of $15 per user/per month). Yammer Basic standalone will also continue to be offered for free.

Beginning March 1, 2013:

  • Yammer Basic standalone: $0
  • Yammer Enterprise standalone: $3 per user/per month
  • New! SharePoint Online (Plan 1) + Yammer Enterprise $4 per user/per month
  • New! SharePoint Online (Plan 2) + Yammer Enterprise $8 per user/per month
  • Office 365 E Plans 1–4 + Yammer Enterprise $8–$22 per user/per month

(all pricing in USD)

Visit the Yammer pricing page to learn more. Stay tuned for more information in the coming months as we add more buying plans!
"

Friday, November 9, 2012

Sharepoint 2013 Newsfeed Vs Office 365 newsfeed

You have liked the newsfeed of Office 365 giving the capability to display videos and images directly on the newsfeed... Your enthousiasm will fall down when you open the newsfeed of Sharepoint 2013...

The videos and photos display simply disappears.

So far, the problem has been mentionned several times on posts
http://community.office365.com/en-us/preview/forums/717/p/72621/273783.aspx
or
http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/1c57452a-12c0-4e11-aa59-f3bc7900d7a7

UPDATE : 14/11/2012
My mistake (I don't erase the current post because the mistake can have been done by others) !!

In fact on the communities sites, the discussion list created as default on the community sites is not displayed on the Office 365 community site. On those sites the site collection feature "Site Feed" is activated and it is the newsfeed that is displayed as main page. There you have the preview displayed and you can embbed photos and videos!








Sharepoint 2013 - Add Geolocation Field in the display view of a discussion List

Imagine the scenario : You 'are on a community, you want to be able to post your position on a post to show the other users your localization. (FB like).

The idea WOULD be :
  • Add a geolocation field
  • Add the field to the display
  • TADAAM it works...
Well obviously, it doesn't!

The method is a bit more complicated. We've worked on it with Laurent Fauret (also from Sogeti) who made the js updates :

Step 1 : Create a site Column Geolocation field
The geolocation fields can't be created manually. So you have to create them using A powershell script or Using Create Geolocation field projet on Code.msdn.microsoft. Add a field in yor discussion list.

Step 2 : Update the discussion display file
The problem is that you never open the viewItems.aspx form when you navigate inside a discussion, you are always on a custom view, so the field you have added on your list, will never show up! So, it means that you have to modify the display js file!

This is not a good way of doing but it's a fast one! You should never touch the standard file of sharepoint, but instead create your owns specific but in this case we will do it for demo purpose (the good way would be to create a discussion list type based on the new display js file!)

So you have to modify the sp.ui.discussions.js located in the 15/TEMPLATE/Layouts. It manages the display of the discussion list. (use the sp.ui.discussions.debug.js to have the indented version).

  • Add your field in the viewfields list in the function
     SP.UI.Discussions.Helpers.$1f = function (m, i) 
  • Change the $2u_0: function (a, d)  to
     $2u_0: function (a, d) {
        ULS06I:;
        this.populateFolderMetalineItems(d);
        a.addCssClass("ms-comm-metalineList ms-noList");

        a.renderBeginTag("ul");
        if (this.jsonItem["My_x0020_Location"]) {
            a.addCssClass("ms-comm-metalineItemSeparator");
            a.addCssClass("ms-comm-metalineItem");
            a.renderBeginTag("li");
            a.write(spMgr.RenderFieldByName(this.$0_0, "My_x0020_Location", this.jsonItem, this.$0_0.ListSchema))
            a.renderEndTag()
        }
        for (var b = 0, c = this.$R_0.length; b < c; b++) {
            b !== c - 1 && a.addCssClass("ms-comm-metalineItemSeparator");
            a.addCssClass("ms-comm-metalineItem");
            a.renderBeginTag("li");
            a.write(this.$R_0[b]);
            a.renderEndTag()
        }
        a.renderEndTag()

    },

  • Change the $2y_0: function (a) { to$2y_0: function (a) {
            ULS06I:;
            var loc = spMgr.RenderFieldByName(this.$0_0, "My_x0020_Location", this.jsonItem, this.$0_0.ListSchema);
            if (loc) {
                a.addCssClass("ms-metadata");
                a.addCssClass("ms-comm-cmdSpaceListItem");
                a.renderBeginTag("span");
                a.write(loc);
                a.renderEndTag();
            }
        a.addCssClass("ms-metadata");
        a.addCssClass("ms-comm-cmdSpaceListItem");
        a.renderBeginTag("span");
        var b = spMgr.RenderFieldByName(this.$0_0, "Created", this.jsonItem, this.$0_0.ListSchema);
        a.write(b);
        a.renderEndTag()
    },



Note :We have called our column "My Location".



Step 3 : Test
It works only on your /discussion%20List/forms/allitems.aspx ... but it f you want to see it working on your site homepage (where the discussion list is already put), you have to revalidate the "subject" view on the discussion list Webpart for the view to be updated with your new field.
An now you will see your GeoLoc picto on your discussion!


And on the click



Thursday, November 8, 2012

Sharepoint 2013 Communities - Create an "Associated Communities" fonction

We are actually building a Social network based on Sharepoint 2013 for a Huge Airways company.

One need was to be able to associate communities together in order to ease the navigation between communities.

To do so, we have used the super powerfull search engine!!

Step 1 : Create a new Display template
  • on your Site collection go to the masterpage catalog (_catalogs/masterpage/Display Templates/Search) and copy the Item_Community.html file.
  • Modify it (For our needs I wanted to display the sitelogo, and change some display). QUite easy to do. It's only manipulating JS and HTML.
  • Post your newly renamed HTML in the same folder and it will automatically create the associated js.
Step 2 : Set a parameter in the propertybag of your site
  • I have added a new property "AssociatedCommunities" on the community using a simple aspx page. The code is simply :
    • Web.AllProperties["AssociatedCommunities"] = "URLCOmmunity1;URLCOmmunity2;URLCommunity3;"
Step 3 : Create a new managed metadata based on your property 
  • Do a full crawl on your content source to make your property available for your search service.
  • In the search service, create a new managed metadata that you will Set as Searchable and Queriable, and then map it on your propertybag property.
Step 4 : Add a search result webpart on your community page
  • Set the following query :
    • WebTemplate:Community AssociatedCommunities:{SiteCollection.URL}
  • In the "Display template" section put "Use a single template to display items" and set your display template
  • I personnaly removed all the options (but the "ranked results" one).
Step 5 : Pray for the search of having done correctly its work!! :)







Thursday, October 25, 2012

Can't add an oinline Apps on your newly created Sharepoint 2013 farm?

So excited with my new toy...
I have found on the Office online app store (http://office.microsoft.com/en-us/store/apps-for-sharepoint-FX102804987.aspx) a Chat app that I wanted to add.

So, on my newly created site, I went to Add an app, I tried to reach my store (easy!) but once arrived on the page of my desired app, I found an unpleasant message "App are not allowed on your Server ...blablablabla..."

After having tried to activate some services manually, trying to reach the "configure App URL",  I checked online and finally found this :
http://sharepointchick.com/archive/2012/07/29/setting-up-your-app-domain-for-sharepoint-2013.aspx
and I finally went there :
http://msdn.microsoft.com/en-us/library/fp179923(v=office.15)

I performed all the steps mentionned on the msdn. It simply worked! So. Forget the easy configuration of SP 2010.

Now you have to create your app store using your powershell interface!

Wednesday, October 24, 2012

Sharepoint 2013 RTM for MSDN Subscribers!

We are actually working on the Enterprise Social Network of a big company. We plan the migration on Sharepoint 2013. So I was about to test the migration  using the RC (Waiting for the RTM then...)

Today, I was looking on my MSDN (ultimate) Account, to retrieve the product key for the RC version... the one I found on the MSDN didn't work on my installation... WHY doing that to me?

simply because today... the version changed to RTM (also did Office 2013!) and so: new product = new Key!

YEAAAHHH :)



 

Friday, December 16, 2011

Custom Form deployment in sharepoint 2007

I have faced a problem today... FOr a customer I 'm actually working on sharepoint 2007 (sigh)...

I have to customize fully a huge form (that contains 200 fields) by adding tabs. It's not the topic but I'm doing it doing jquery (and that rocks).

In order to do it,you just have to open your editform.aspx newform.aspx and dispform.aspx, and to replace it with new forms using a feature that copy the new form in the list form folder. The topic of this blog is the content of those aspx file.

To create it, I have simply copied the content of my old EditForm . I have erased everything contained in the PlaceHolderMain .

And I have (in sharepoint Designer) inserted the form content using :
insert > Sharepoint Control > Customize a list form and I have selected my list...

NOW ...THE PROBLEM ...
I have added my tabs, everything works fine on sharepoitn designer but...mmm I want to deploy it on 100 sites containing the same list...
Should I do it manually? obviously no... But if you try to do it directly you will face a bug saying
"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator. "

If you look inside your form you will find :
<ParameterBinding Name="ListID" Location="None" DefaultValue="{ID OF YOUR LIST}"/>That you have to replace by
<ParameterBinding Name="ListName" Location="None" DefaultValue="NAME OF YOUR LIST"/>
AND

<WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{IDOFYOURLIST}" Name="ListID"></WebPartPages:DataFormParameter>

that you have to replace (4times) by


<WebPartPages:DataFormParameter ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="{Name of your list}" Name="ListID"></WebPartPages:DataFormParameter>


And because now you can deploy it manually (because there is no more reference to the list ID (that is different in every site)

Thursday, November 17, 2011

I'm a .net Ranger by Sogeti!

I'm glad to tell you that I have joined the .net Rangers community at Sogeti.

The .net Rangers community is a small amount of Sogeti's Microsoft oriented experts .

Follow us :

http://www.dotnetrangers.net/



ListViewWebpart and XsltListViewWebPart

I have a colleague (Nicolas Corchia - Sogeti) who came into my office with a migration 2007>2010 problem.

The 2007 Codes analysed a webpartpage in order to find the ListViewWebpart included in it in order to modify them...
Well... after the migration...no more listViewWebpart were found... He came out with the fact that sharepoint automatically changed the listviewPart by the new XsltListViewWebPart class.

Because nicolas is a good developer ;-) he found out that the problem was wimply a casting problem obliging him to recast the webparts in the code itself!

Find more in : http://msdn.microsoft.com/fr-fr/library/ff806162.aspx




Thanks to a problem raised by Nicolas Corchia (Sogeti),

Thursday, January 27, 2011

Workflow Action : Attach Document to ListItem

I have been really disapointed when realizing that I couldn't Attach a document to an item when I designed a workflow. So, to me this action was definitly missing. I needed it in a document library list with incoming email feature activated in order to be able to send emails to this library and those emails to be managed to be linked automatically to other items in other lists... For this custom activity, I have been assisted a member of my team: Yassine Hachime.


I won't explain here The principle on How to create Custom Activity on Sharepoint 2010, this topic has already been explained several times on the web :

http://www.chaholl.com/archive/2010/03/13/make-a-custom-activity-available-to-sharepoint-designer-2010.aspx or
http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/4e7a77f4-c29b-47b2-a1de-79470f0bb1c9


My plan is just to give you one more action to add to your SPD.
I will just provide you the code for the action file and the bin. I'll leave you the rest of the job.


Here is the action file :



<?xml version="1.0" encoding="utf-8"?>

<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="Attach Doc to Item"
ClassName="AttachMailWFActivity.AttachDocToItem"
Assembly="AttachMailWFActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=46f60639ee1bfb57"
AppliesTo="all" Category="List Actions">
<RuleDesigner Sentence="Attach %1 to %2">
<FieldBind Text="this document" Field="LibId,DocItem" DesignerType="ChooseDoclibItem" Id="1" />
<FieldBind Text="this item" Field="ListId,ListItem" DesignerType="ChooseListItem" Id="2"/>
</RuleDesigner>
<Parameters>
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" />
<Parameter Name="LibId" Type="System.String, mscorlib" Direction="In" InitialBinding="__list"/>
<Parameter Name="DocItem" Type="System.Int32, mscorlib" Direction="In" InitialBinding="__item" DesignerType="ListItem" Description="ID of the list item used by this action." />
<Parameter Name="ListId" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="ListItem" Type="System.Int32, mscorlib" Direction="In" DesignerType="ListItem" Description="ID of the list item used by this action." />

</Parameters>
</Action>

</Actions>

</WorkflowInfo>



And the code of the
AttachMailWFActivity.AttachDocToItem assembly is :



using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Linq;
using System.IO;
using Microsoft.SharePoint;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using Microsoft.SharePoint.WorkflowActions;
using System.Workflow.Activities.Rules;

namespace TSP.AttachMailWFActivity
{
public partial class AttachDocToItem : Activity

{

public static DependencyProperty LibIdProperty = DependencyProperty.Register("LibId", typeof(string), typeof(AttachDocToItem));
public static DependencyProperty ListIdProperty = DependencyProperty.Register("ListId", typeof(string), typeof(AttachDocToItem));
public static DependencyProperty DocItemProperty = DependencyProperty.Register("DocItem", typeof(Int32), typeof(AttachDocToItem));
public static DependencyProperty ListItemProperty = DependencyProperty.Register("ListItem", typeof(Int32), typeof(AttachDocToItem));
public static DependencyProperty __ContextProperty = DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(AttachDocToItem));

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[ValidationOption(ValidationOption.Required)]
[Browsable(true)]
[Description("ID of the document library storing the doc that will be attached to the item")]
public string LibId
{
get { return ((string)(base.GetValue(AttachDocToItem.LibIdProperty))); }
set { base.SetValue(AttachDocToItem.LibIdProperty, value); }
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[ValidationOption(ValidationOption.Required)]
[Browsable(true)]
[Description("ID of the list keeping the item to which the document will be attached to")]
public string ListId
{
get { return ((string)(base.GetValue(AttachDocToItem.ListIdProperty))); }
set { base.SetValue(AttachDocToItem.ListIdProperty, value); }
}

[Description("ID of the list item to which the document will be attached to")]
[ValidationOption(ValidationOption.Required)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Int32 ListItem
{
get { return ((Int32)(base.GetValue(AttachDocToItem.ListItemProperty))); }
set { base.SetValue(AttachDocToItem.ListItemProperty, value); }
}

[Description("ID of the document item to which the document will be attached to")]
[ValidationOption(ValidationOption.Required)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Int32 DocItem
{
get { return ((Int32)(base.GetValue(AttachDocToItem.DocItemProperty))); }
set { base.SetValue(AttachDocToItem.DocItemProperty, value); }
}

[Description("Context")]
[ValidationOption(ValidationOption.Required)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public WorkflowContext __Context
{
get { return ((WorkflowContext)(base.GetValue(__ContextProperty))); }
set { base.SetValue(__ContextProperty, value); }
}


protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{

__Context.Web.AllowUnsafeUpdates = true;

Guid id = new Guid(ListId);
SPList list = __Context.Web.Lists[id];
Guid did = new Guid(LibId);
SPList docLib = __Context.Web.Lists[did];
SPListItem sourceItem = docLib.GetItemById(DocItem);
SPFile sourceDoc = sourceItem.File;
byte[] fichierbyte = sourceDoc.OpenBinary();

SPListItem destinationItem = list.GetItemById(ListItem);
destinationItem.Attachments.Add(sourceItem.Name, fichierbyte);
destinationItem.Update();
return ActivityExecutionStatus.Closed;

}
catch (Exception Ex)
{

return ActivityExecutionStatus.Faulting;
throw new Exception(Ex.Message + "&&&&" + Ex.StackTrace);

}
finally
{

}
return ActivityExecutionStatus.Closed;
}

public AttachDocToItem()
{
InitializeComponent();
}
}
}




Now you've got that.
Just :
- Create a sharepoint 2010 empty project
- Create a class and copy the code
- Create an action file and copy the code
- Sign your assembly
- Package your wsp
- Install the wsp on you WFE. Deploy it.
- Add the correct line in the AuthorizedType tag of your web.config.


The result :



(for the capture... it's because my SPD Is in french)


I hope it helps.
Don't hesitate to contact me whether you are in trouble using it !!!


Item Created Workflow won't start with incoming email document uploaded

Hello,

It's been a while since my last post.
I was not in the mood ;) (or overloaded with work)... I have a few post to write... I hope it will be done in the few next days. I'm planning to explain the last SPD WF Action I have written (Attach Document to Item)....

But right now my post just describes a problem with the library with incoming email feature activated. When you send an email to the library, the automatic workflow launched at item created are simply not raised. It works for the items you add normally though.

Workaround?
Yeess. I found this post http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/810d0273-06f3-4815-b690-86d0fc880919

So, you just have to run this command line :

Stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true


It worked for me !!!

Thursday, December 23, 2010

Display an exchange public calendar inside sharepoint

To display an Exchange public calendar inside a sharepoint page use a pageviewer webpart, and choose the url this way
https://your_exchange_server/owa/?cmd=contents&module=PublicFolders&f=Calendar
(don't use that kind of url , https://your_exchange_server/public/Calendar/?view=monthly, you may have access is denied error )

Friday, July 30, 2010

Sharepoint 2010 - Create an Audience based ACL

I have been asked to manage the security of an application according to the user profile organization's property.... Well obviously, sharepoint is not designed like that. So, how to ?

My solution is the following :
  • Fill the organization property on each of the profile
  • Create one audience per organization based on this property
  • Synchronize the audiences with Sharepoint groups using a timer job (that's the main part of the article)
I won't explain the two first points, I guess you already know how to create and compile audiences, else go back to the root first !

The principle of my timer job is simple. It is activated using a feature that is scoped webapplication. The execute method parses all the sites of the applications, and the audiences of the platform. It thus verify that a group with the same name exists on the site. If not, it creates the groups, If it does exist, it just adds the users in the group.
So at the end I have on all my sites, the same groups with the same users and everything is based on the audiences that are based on the user profile properties ... Quod Erat Demonstratum.

Below the execute Method of the Timer job:

try
{
SPWebApplication webApplication = this.Parent as SPWebApplication;
AudienceManager audManager = new AudienceManager(SPServiceContext.GetContext(webApplication.Sites[0]));
foreach (SPSite site in webApplication.Sites)
{
foreach (Audience au in audManager.Audiences)
{
try
{
if (site.RootWeb.SiteGroups[au.AudienceName] == null)
{
}
}
catch (Exception exx)
{
SPUser oUser = site.RootWeb.Users.GetByEmail("alexandre.joly@toto.com");
SPMember oMember = site.RootWeb.Users.GetByEmail("alexandre.joly@toto.com");
site.RootWeb.SiteGroups.Add(au.AudienceName, oMember, oUser, "Group synchronized on existing audience");

}
SPGroup group = site.RootWeb.SiteGroups[au.AudienceName];
ArrayList members = au.GetMembership();
if (members != null)
{
foreach (UserInfo userInfo in members)
{
group.Users.Add(userInfo.NTName, userInfo.Email, userInfo.PreferredName, "");
}
}
}
}

}
catch (Exception exc)
{

}

Thursday, June 24, 2010

Migrating Sharepoint 2010 Beta to RTM

As most of you may have seen... migrating Beta to RTM is not something supported by MS. Of course, we all understand that the corrected bug of the beta may cause problem on you newly installed flashy RTM Platform... BUT... some of us (at least me) have been asked to put in production a beta platform... and now.. with 10000 items in a list... what can I do ? hiring 100 persons to recreate my items ... obviously not So let's find a way..

  1. Using the Backup site collection feature in the central admin on your beta platform, back up the entire site collection that contain you web or you list (dont try to' export only list or webs using powershell commands, it simply doesn't work (version conflicts).
  2. Using the restore-spsite powershell command to restore your site collection on your new platform...
  3. Yessss! Now you have you data on you new platform.. YESSSSS, it feels already better... (OOOH Damned.. I have lost my term store connection, arrrg)
  4. use the Content deployment wizard tool of Cris O Brien (Sharepoint MVP) to migrate content from your site collection to your new site. In my case I only had to migrate 3 big lists with content types.
in my case, I had to launch several other scripts to resolve my term store connection problem (I parse my old list to find the termstores values and I pars my new list to put back those values....)
I'm sure it can work without doing that but I didn't find the way !


Good luck

Monday, March 1, 2010

Sharepoit 2010 - Search service application

One of the multiple evolutions of the last version of Sharepoint upon the last one is how Sharepoint manages the different services.

Bye bye Shared Service Provider (SSP), Hello the Services applications.

The management of those applications is accessible via the "manage Service applications" of the central admin page.
Yesterday I had a super search app that was working fine with all my scopes and metadatas. Sounded good, no?
Obviously, it's when things go the best that some ununderstandable sh.t happens... In my event viewer, from yesterday nigth til now and every minutes, I had a message saying that my crawl DB wasn't accessible. Damned What have I done??
So as a solution I tried to reset all my indexes... Nope..
I then tried to detach and attach the Search App db... Nope...
I finally decided to save all my settings and to delete my search application (and all the DBs and to recreate it (I'd rather take 1h to do this instead of asking myself the all day "what the fuck wht the fuck"

Here I am now... I can't create a search application : the form opens asking me the app pools and the account , and after a minute and 31 seconds... I have this error

"
Errors were encountered during the configuration of the Search Service Application.
System.Data.SqlClient.SqlException: User does not have permission to perform this action. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.Office.Server.Data.SqlServerManager.GrantLogin(String user) at Microsoft.Office.Server.Search.Administration.SearchDatabase.GrantAccess(String username, String role) at Microsoft.Office.Server.Search.Administration.SearchDatabase.SynchronizeAccessRules(SearchServiceApplication searchApp) at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.SynchronizeDatabases() at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.Provision() at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.b__22() at Microsoft.Office.Server.Search.Administration.SearchAdminUtils.UpdateIgnoreSPUpdatedConcurrencyException(String description, SearchAdminUtilsUpdateDelegate updateDelegate, SearchAdminUtilsRefreshObjectDelegate refreshObjectDelegate) at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.CreateSearchApp() at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.ProvisionSearchServiceApplication() at Microsoft.Office.Server.Search.Administration.SearchConfigurationJobDefinition.ExecuteTimerJob()
"

Ooupppppps, so... so far.... no search service for my users :-/

Mmmm, let's check what could have happened ...
This line is interesting "
Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.Office.Server.Data.SqlServerManager.GrantLogin(String user) "

Am I having SQLServer secrutiy troubles??
If I check the security settings in SQL Server on my staging environment and on my production environment I notice that my service account on my production environment doesn't have the "SecurityAdmin" right ... DAMNED ! I GOT YOUUUUUUU !!

Retry...
YESSSSSSSSSS !


Wednesday, January 27, 2010

Term Store and views

After a 2 months using sharepoint 2010 every days, I have extracted in this new version a wonderfull feature : the term store. It allowed us to simplify a lot the architecture.

Now, the list of customers and projects to which the data is linked all around the information system is tagged using termsets. Easy to create, easy to maintin.

Before I had to create linked list to simulate the hierarchy... now, everything is done my itself.

I won't make a all blog on this feature, some other blogs already did it :
http://www.wssdemo.com/Blog/Lists/Posts/Post.aspx?List=b853926a-b04e-4620-94e4-88a5d56cb262&ID=494&Web=d47402ad-1767-42ba-a072-133479a9bb5a
or
http://www.cmswire.com/cms/document-management/overview-sharepoint-2010-metadata-and-taxonomy-management-006015.php


One bad point though... This morning I wanted to create views grouped by my customer column (which is a managed metadata column), How disappointing it was when I noticed that It was simply impossible :( Those kind of column don't appear in the list.

So be aware that grouping and sorting is not available for Managed metadata columns.