Home RSS 2.0 ATOM 1.0  CDF  
 
CodeSegment - Carlos Segura Sanz (blog)
 
Previous Page Page 2 of 6 in the SharePoint category Next Page

Well, today the first day of 2007,I Want to thank all the people who read this blog for this stats. Also today I received my MVP award renewal.
Gracias a todos los que me leéis, seguiré dando la lata :-)

También mis felicitaciones para Miguel Jimenez, Rodrigo Corral, Marco Amoedo, Haaron Gonzalez

Monday, January 01, 2007 11:32:14 PM (Hora estándar romance, UTC+01:00)   #    Comments [0]   Misc | SharePoint | SharePoint-es  | 

In order to add a new activity to our SharePoint Designer, first  we need to begin a WorkFlow project  in Visual Studio 2005,  concretely, a Workflow Activity Library (Workflow activity library).


From  this point we would create our activity; for this example I am going to create an activity that will send a text to the event viewer.

   1:  public partial class LogEventViewer : Activity
   2:  {
   3:     
   4:      public static DependencyProperty TextLogProperty =
   5:          DependencyProperty.Register("TextLog", typeof(string), typeof(LogEventViewer));
   6:   
   7:      public LogEventViewer()
   8:      {
   9:          InitializeComponent();
  10:      }
  11:   
  12:      /// <summary>
  13:      /// Valor que figurará en el visor de eventos
  14:      /// </summary>
  15:      /// <value>Texto</value>
  16:      [Description("Texto que saldrá en el visor de eventos")]
  17:      [Category("User")]
  18:      [Browsable(true)]
  19:      [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
  20:      public string TextLog
  21:      {
  22:          get { return (string) GetValue(TextLogProperty); }
  23:          set { SetValue(TextLogProperty, value); }
  24:      }
  25:   
  26:      /// <summary>
  27:      /// Ejecución de la actividad
  28:      /// </summary>
  29:      /// <param name="provider">Contexto de ejecución de la actividad</param>
  30:      /// <returns></returns>
  31:      protected override ActivityExecutionStatus Execute(ActivityExecutionContext provider)
  32:      {
  33:          EventLog eventLog = new EventLog("Workflow");
  34:   
  35:          eventLog.Source = "SharePoint Workflow";
  36:   
  37:          try
  38:          {
  39:              eventLog.WriteEntry(TextLog, EventLogEntryType.Information);
  40:          }
  41:          finally
  42:          {
  43:              eventLog.Dispose();
  44:          }
  45:   
  46:          return ActivityExecutionStatus.Closed;
  47:      }
  48:  }

 

First,  we  declare a dependent property of the workflow called TextLogProperty,  which we will use to pass the text that we wish to  show in the event viewer.

The internal property of the activity will be TextLog; this internal property obtains and establishes the value from the dependent property of the workflow.

Then we  define the Execute method, that  will be the  method in charge to  visualize the message in the event viewer.

A good practice is that the activities include a Validador, that I have omitted in the example but that is highly  recommended although  not obligatory, or if we want to use the activity inside of the visual studio workflow designer.

Once we have made the compilation, we can test it first (another good practice) creating an application to host the workflow and checking the activity.

Finally, after we are sure that our activity works correctly, we must install it in the GAC in our SharePoint server. And we need to modify the Web.config to include our assembly in the following section:

 <System.Workflow.ComponentModel.WorkflowCompiler>
   <authorizedTypes>
       ......
     <authorizedType Assembly="IdeSeg.SharePoint.Workflow.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3bba710be857fdc1" 
                     Namespace="IdeSeg.SharePoint.Workflow.Activities" 
                     TypeName="*" 
                     Authorized="True" />
   </authorizedTypes>
 </System.Workflow.ComponentModel.WorkflowCompiler>


 Now we  need to modify the file WSS.ACTIONS that we saw  in the first article in order to add our new action

 <Action Name="Log en visor de eventos"
         ClassName="IdeSeg.SharePoint.Workflow.Activities.LogEventViewer"
         Assembly="IdeSeg.SharePoint.Workflow.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3bba710be857fdc1"
         AppliesTo="all"
         Category="Personalizadas">
    <RuleDesigner Sentence="Logear el evento siguiente %1">
      <FieldBind Field="TextLog" Text="este mensaje" Id="1" DesignerType="TextArea"/>
    </RuleDesigner>
    <Parameters>
      <Parameter Name="TextLog" Type="System.String, mscorlib" Direction="In" />
    </Parameters>
</Action>

What we have done in the first place  is  authorize our assembly  so that  he is now an integral part of the  WorkFlow engine of SharePoint, and secondly, adding it  to the WSS.ACTIONS file, we have indicated to  the SharePoint Designer that  we have added a new activity.

When we use SharePoint Designer to publish a site, at the moment that we created a new workflow or we published  an existing one,  he communicates with SharePoint and recovers the File WSS.ACTIONS  to configurate the assistant of  the WorkFlow.

In this way the new actions will  be part of the file XOML that  the SharePoint Designer will create. 
Finally the result within the SharePoint Designer will be as follow:

Wednesday, December 13, 2006 12:35:43 AM (Hora estándar romance, UTC+01:00)   #    Comments [0]   SharePoint  | 

Without a doubts one of the best things of MOSS 2007  is the new SharePoint Designer, and within him, the workflow designer, that  allows us speedy  and simple form to design  workflows. 

As I have commented in other occasions, if we wish to make more complex workflows, or state machines, we need to use Visual Studio.  

SharePoint Designer, allows us to make sequential workflows with predetermined activities. Nevertheless, the possibility to extend the basic activities exists  and we can extend the functionality of ours workflows without  to write them completely in Visual Studio.
 
Out-the-box, SharePoint Designer includes 22 actions.
 


 
Those actions are defined in the file WSS.ACTIONS, that resides in the directory “C:\Program Files\Common files\Microsoft Shared \web server extensions\12\1033\TEMPLAT\Workflow”. 
 
In this file, the conditions and the actions that appear within SharePoint Designer are defined.

<Condition Name="Creado en un intervalo de fechas determinado"
           FunctionName="CreatedInRange"
           ClassName="Microsoft.SharePoint.WorkflowActions.Helper"
           Assembly="Microsoft.SharePoint.WorkflowActions, 
                  Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
AppliesTo="list" UsesCurrentItem="true"> <RuleDesigner Sentence="creado entre %1 y %2"> <FieldBind Id="1" Field="_1_" Text="fecha" DesignerType="Date"/> <FieldBind Id="2" Field="_2_" Text="fecha" DesignerType="Date"/> </RuleDesigner> <Parameters> <Parameter Name="_1_" Type="System.DateTime, mscorlib" Direction="In"/> <Parameter Name="_2_" Type="System.DateTime, mscorlib" Direction="In"/> </Parameters> </Condition>


Herein,  we can see the assembled dll that handles the condition, to which elements  he is applied, and if it is possible to use the present item in the workflow.

Within the condition we have the rule for the designer, with the text that is going to appear; each rule uses a series of fields tags FieldBind, that connects with the necessary parameters in the assembled file.

Each tag FieldBind has an identifier that  corresponds with the position of the field within sentence ID=1, and that will be %1 in the sentence attribute as well.
Also we can see attributes like Text, that will be the text by defect, and the DesignerType, that is the type of field.

After that, we have the section of Parameters with the different parameters that will go to the assembled file. The Name attribute has to correspond with the Field attribute of tag FieldBind, and the direction of the parameter needs to be In for input and Out for output.
 

<Action Name="Establecer estado de aprobación del contenido"
  ClassName="Microsoft.SharePoint.WorkflowActions.SetModerationStatusActivity"
  Assembly="Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, 
               Culture=neutral, PublicKeyToken=71e9bce111e9429c"
AppliesTo="list" ListModeration="true" Category="Acciones principales" UsesCurrentItem="true"> <RuleDesigner Sentence="Establecer estado de aprobación del contenido en %1 con %2"> <FieldBind Field="ModerationStatus" DesignerType="Dropdown" Id="1" Text="este estado"> <Option Name="Aprobado" Value="Approved"/> <Option Name="Rechazado" Value="Denied"/> <Option Name="Pendiente" Value="Pending"/> </FieldBind> <FieldBind Field="Comments" Text="comentarios" Id="2" DesignerType="TextArea" /> </RuleDesigner> <Parameters> <Parameter Name="ModerationStatus" Type="System.String, mscorlib" Direction="In" /> <Parameter Name="Comments" Type="System.String, mscorlib" Direction="Optional" /> <Parameter Name="__Context"
      Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" /> <Parameter Name="__ListId" Type="System.String, mscorlib" Direction="In" /> <Parameter Name="__ListItem" Type="System.Int32, mscorlib" Direction="In" /> </Parameters> </Action>


Now, we are going to see how the actions look in the same file; they are very similar to the conditions.  


The first part includes the assembled one that will take care to handle the action.
The second one, are the rules for the designer. In this case the fields that has been used are a combobox (DesignerType= " Dropdown ") and a line of text (DesignerType= " TextArea ")
The third part of the parameters, besides to use both fields defined in the rule of the designer, uses three additional parameters that are:

__Context: that it is the context of the WorkFlow.
 __ListId: you go of the list with which we are working
__ListItem:  the present item

With these three fields (that they are pre-established, so that we can use them whenever we want) we have as much control on the list as on the job stream that is being carried out.


At the moment A file XSD for this type of archives does not exist.

Tuesday, December 12, 2006 5:30:53 PM (Hora estándar romance, UTC+01:00)   #    Comments [0]   SharePoint  | 

Today in the Javier Castle in Navarra we celebrated an informal SharePoint meeting very interesting.

Talking about Office Sharepoint Server 2007 and migration scenarios from SPS 2003, and of course other things.

In the photo Rolf Eleveld [right], Gustavo Velez [center]  (both from Winvision, Holland) and me [left] in a break.

Monday, October 16, 2006 11:33:03 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint | SharePoint-es  | 

Do you remember?, SharePoint 2003 continues alive. This night I updated my csegSmallCalendar webpart with some new features. Now I’m designing a web site to host the NavarraDotNet.com user group and I have needed for this new features.

AdjustCurrentMonth
Now you can adjust the month  that the calendar is showing, If we are in September, and you adjust the calendar with a -1 value you can view August month, same with a 1 value you can view the current month  +1. Now you can display more than one month adding new webparts.

Adjust date Format
Now you can change the format used in the filters, some international users will be happy with this.

Filter Field Name
In the previous version the field name passed in the filter was the field name from the list where we are taking the data, and you only could filter lists that are using the same field name. Now you can see task dates and filter an event list.

     

 csegSmallCalendar2.zip (17,82 KB)
Friday, September 29, 2006 10:23:10 AM (Hora de verano romance, UTC+02:00)   #    Comments [6]   csegSmallCalendar | SharePoint  | 

Son casi las 9 de la noche y ya me iba del trabajo a casa cuando he recibido este correo:

Carlos,

I just wanted to take a moment (as others have) and thank you for the generous work you do, providing SharePoint solutions to the community.
Your hard work is shared and used by many; there are not a lot of people in this world willing to sacrifice their own time for others.

Thanks again,

Bill Burke 

No es el primero (y espero que no sea el último), pero me ha emocionado especialmente. Hay días más duros que otros y mensajes como este realmente te EMPUJAN ha seguir haciendo las cosas que haces.

Gracias a ti Bill y a todos.

Monday, September 25, 2006 9:02:08 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   Misc | SharePoint | SharePoint-es  | 

Yesterday in Pamplona one “wine and beef “ tech-meeting in the “Asador Zubiondo”.
Miguel Jimenez from Ilitia, working these days in Pamplona at Tracasa teaching Agile development methodologies.
Luis Colmenar from Microsoft is a SharePoint consultant, and he is working at Navarra Government.

Friday, June 23, 2006 9:46:47 AM (Hora de verano romance, UTC+02:00)   #    Comments [1]   Misc | SharePoint  | 

He estado migrando algunos de los servidores de SharePoint, y he dado con este mini procedimiento para hacer el upgrade de un servidor a SQL 2005, siempre que se instale en la misma máquina.

1.- Parar el servicio de MSDE
2.- Instalar SQL Server 2005
3.- Copiar las bases de datos en el directorio Data de SQL Server 2005
4.- Adjuntar las bases de datos desde el Management Studio
5.- Ir a la administration central de SharePoint (Windows SharePoint Services)
6.- Establecer el servidor de bases de datos de configuración introducir el nombre del servidor donde esta el nombre de la instancia de MSDE
7.- Marcar Conectarse a la base de datos de configuración existente
8.- Eliminar la clave DSN de [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\Secure\ConfigDb]
9.- Entramos en el SQL Management Studio - Seleccionamos la base de datos SPS01_Config_db y modificamos la tabla  Services, hay que eliminar la instancia ya que con el SQL 2005 no es necesario. Ponemos NULL.

10.- Entramos en la Administración central de SharePoint Portal y seleccionamos "Establecer el servidor de bases de datos de contenido predeterminado" y ponemos el nombre de nuestro servidor.

11. IISRESET y desinstalar MSDE (esto último es muy divertido)

Tuesday, May 23, 2006 10:23:29 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint | SharePoint-es  | 

WebPart Description Download Link Latest Version
csegSearchResults SPS improve search results, boolean searches, higlight results Download
csegRollUp RollUp lists Download
csegAlerts Manage user alerts Download
csegMiniWiki A mini wiki (new version soon) Download
csegScriptWebPart Write VB.NET code inside and test your webparts and snippets Download
csegModifyMenu Modify the edit page menu Download
csegDocLibTools Copy and Paste documents in document libraries Download  unfinished
csegNavigator Two webparts to navigate subwebs and areas Download
csegWebContent A web content webpart with improvements Download
csegPSSearch Custom searches and results for portal areas Download
csegInfoPathViewer Infopath form viewer Download
csegSmallCalendar Small calendar to filter lists and view dates with events Download
CAML Editor A mini editor for CAML files Download
Thursday, May 11, 2006 12:42:06 AM (Hora de verano romance, UTC+02:00)   #    Comments [1]   SharePoint  | 

You can use now the row provider to select the infopath form (rememeber that the view need contains the ID field).
The problems rendering fields with special characters is now solved.
Also I added a cell consumer interface to get the ID from other webpart as csegRollUp 

In the properties you need add the XSL (see previous version) and the name of the form library.

If you can´t display the infopath form, check if  you can get the XML from the server using the form Url. Some users are using a WSS environment where they don´t use DNS to resolve the url where WSS is located, they are using an entry in the hosts file. In this case the server can´t resolve the Url where the form is located. To solve this issue you can add the host name in the hosts file of your server.

  csegInfoPathViewer12.zip (15,11 KB)
Tuesday, May 09, 2006 7:53:44 PM (Hora de verano romance, UTC+02:00)   #    Comments [4]   csegInfoPathViewer | SharePoint  | 

Previous Page Page 2 of 6 in the SharePoint category Next Page

Copyright © 2008 Carlos Segura. All rights reserved.