samedi 20 septembre 2014

Get workflow task related item

  SPList list = null;
var relativeUrl = SPContext.Current.Web.ServerRelativeUrl.Equals("/") ? string.Empty : web.ServerRelativeUrl;

                list = SPContext.Current.Web.GetList(string.Concat(relativeUrl, "/Lists/", listname));
                list = SPContext.Current.Web.GetList(string.Concat(relativeUrl, "/", listname));

list .commandesList.GetItemById(int.Parse( currentItem[SPBuiltInFieldId.WorkflowItemId].ToString()));

vendredi 5 septembre 2014

Remove the default Task Outcomes (Approved rejected)

  • Create a new Task List Instance (new workflow wizard will help you do it)
  • new Custom List Column with type OutcomeChoice

<Elements xmlns="">  
       Group="Custom Site Columns">

      <CHOICE>very goodt</CHOICE>

  • new ContentType Inherit from Workflow Task (SharePoint 2013)  (we will edit this later)
  • Add the Custom Column to the contentType
  • from the contentType Element.xml remove this string  003365C4474CAE8C42BCE396314E88E51F
So an ID like:
0x0108003365C4474CAE8C42BCE396314E88E51F00B237734C3B3E48D38A52DAAA52F56A8F  ==> 0x010800B237734C3B3E48D38A52DAAA52F56A

  • Open the file Workflow.xaml with xml editor 
  • find your <p:SingleTask
  • change ContentTypeId to the new id you just modified (0x010800B237734C3B3E48D38A52DAAA52F56A)
  • go to your TaskList instance and Add your contentType:
  <ContentTypeBinding ListUrl="Lists/InterventionList" RootWebOnly="FALSE" ContentTypeId="0x010800B237734C3B3E48D38A52DAAA52F56A" />
  • Deploy your project and see the magic happens
Please leave a comment if you need clarifications

jeudi 4 septembre 2014

Workflow manager not responding after cumulative update


If you have updated your workflow manager using the cumulative update :

So you probably facing an issue with your workflow manager, right ?

Ok this is how to fix it (it's weird I konw but this works for me)

Open your SQL management studio and run this script in the Sharepoint database

USE WFResourceManagementDB
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceScopeSnapshotProcessBatchSize', '50')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceScopeSnapshotProcessLoopInterval', '00:05:00')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceSuspendedInstanceRetentionDuration', '00:30:00')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceMaxInstanceCompressedSizeKB', '5120')

This solution will help you deploy workflows again but you will be facing many other problems. so I recommand to reinstall your workflow manager on a clean Database. (reusing an existing database will not resolve your problems)

so detach your workflow manager from the farm and remove this databases list:

  1. WfManagementDB
  2. SbGatewayDatabase
  3. SBMessagingContainer01
  4. WFInstanceManagementDB
  5. WFResourceManagementDB
  6. SBManagementDB
And then you will be able to have a new workflow manager clean installation.

mercredi 3 septembre 2014

sharepoint 2013 Show Errors (why it's not working for you)

To disable the custom error page in  sharepoint 2013 you have to set  
<customErrors mode="On" /> to <customErrors mode="Off" /> 

Ok but this may not work , right ? I tell you why.

For sharepoint there is many web.config files located under:


but non of them will work as expected for pages using layouts.

To make it work, you must modify the web.config under

"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS"

Hope it works for you either. 

Sharepoint 2013 & Custom Task Outcome on VisualStudio

This is the how it works:

Add new SiteColumn
Change the Type param value to "OutcomeChoice" in <Field /> tag

Add :   <CHOICES >
                <CHOICE>choice one</CHOICE>
                <CHOICE>choice two</CHOICE>
Add new ContentType  and inherit from Workflow Task (SharePoint 2013)
Add Columns: 
  • % Completed
  • Task Status
  • The custom OutcomeColumn
NB: The order is Important, if the custom Outcome Column is not the last one choices will appear as a DropBox and to as buttons

Add new Task List Instance (Or a Custom list template)

Insure the TemplateType is set to "171" (this Id reference Task template)

If you are working with a Task list Instance Add Schema.xml file to it and copy content from a Task list template (create a new Task list template, copy schema.xml content, modify List Name and URL to match your List Instance )

Deploy and happy to help you.

Please let me know if there is any issue so i can update this article

mardi 16 octobre 2012

PHP Curl wamp Et windows

L'installation de curl sur windows peut poser des problèmes, il ne suffit pas d'activer l'extension du fichier php.ini mais il faut s'assurer que l'extension php_curl correspond avotre version php.

la correction de ce problème réside dans la modification de ce fichier par le DLL adéquat a la version de PHP installé.
pour la version php 5.4.3, la version curl installé par défaut présente des bugs. d'où il faut la modifier par le fichier suivant

php5.4.3 =>

mardi 3 avril 2012

Add attachements on SharePoint Item

Hi, developpers today i'm writing this duing to lack of information in the internet about adding attachements on sharepoint Item client side. So first of all if you are using "Client context" it's hight time to know that it cant do every thing for you.
This tutorial is about adding attachement using Sharepoint web services.
So if you are trying to do the same I think you are enought able to consume a web service. so try to connect on your sharepoint Web service (the one that ends with "http://your_domain/_vti_bin/lists.asmx")  and name it "ListsService 

ListsWebService.Lists ListsService = new ListsWebService.Lists();

Here you are with full controle on your sharepoint. So now you can start reading your file to attach.


 FileStream fStream = System.IO.File.OpenRead(filePath);
 byte[] contents = new byte[fStream.Length];
 fStream.Read(contents, 0, (int)fStream.Length);

gooood nice #MOMTAZ you are ready to attach it to your Item, ToDo you have to know the ID of your Item on the sharepoint, Go Get it I'm weating for you, the ListName or GUID (I'm using the ID of the List) and the fileName. and just call the methode AddAttachement of the web service.

ListsService.AddAttachment(GUID, ItemId, fileName, contents);

I'm using thoes params as exemple: 
  • GUID:c3a01ef7-95ba-4230-8754-ea288f93fd31
  • ItemId: 250
  • fileName: doc1\folder2\XXXXX.docx (this is not an xxx content)
  • contents: {bytes[12]}

So this is what we got (just copy and have fun):

ListsWebService.Lists ListsService = new ListsWebService.Lists();
FileStream fStream = System.IO.File.OpenRead(filePath);
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
ListsService.AddAttachment(GUID, ItemId, fileName, contents);