| serge's profileSerge Luca (Sharepoint M...PhotosBlogLists | Help |
|
August 30 My live (hotmail) mail account moved to 5 GB !!!!here is what I saw this evening in my Windows live mail(hotmail) account:
August 15 Content type & SPFieldLink & SPFieldI'm currently teaching a Sharepoint course for U2U in the splendid city of Gothenburg (Sweden).
A student asked me an interesting question about what is a SPFieldLink.
The correct answer is that a content type (SPContentType class) doesn't have columns (SPField) (a list does), but the content type has just references to fields (Site columns) and this references are SPFieldLink.
SPContentType as a FieldLinks collection that returns all the SPFieldLink (s).
A quick look at the sdk confirmed this point of view, but I noticed that there was also a Fields property in the SPContent class (of type SPFieldCollection).
Reflector and the following article (see the postscript) confirmed the fact that this Fields property is just a merged view of FieldLinks.
There is a 1-1 correlation between the items of FieldLinks and those of Fields.
August 03 Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007 (part 9/20)Step 9/20. Using ASXP forms in workflows[24/11/2008] Update : I cover aspx association forms in step 14 with much more details. Scenario
Since WSS doesn’t allow the use of Infopath Forms , we will write our initiation form in “pure” aspx. [Note: we will improve and extend this sample in the future]
Hands-on
We’ll start from step 8 solution. In the U2UExpenseReport project, add a text file with an aspx extension : InitManager.aspx. In source mode, copy and paste the following code fragment in the aspx page: <html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Temporary Manager
<asp:TextBox ID="TextBoxManager" runat="server"></asp:TextBox>
<asp:Button ID="ButtonSubmit" runat="server" Text="Submit" />
</div>
</form>
</body>
</html>
In design mode, the page will look like this:
Let’s add a new class, InitManager in a file InitManager.aspx.cs (make sure the class is public !).
Derive InitManager from the Page class :
public class InitManager : System.Web.UI.Page
{
Add the page directive at the top of InitManager.aspx:
We need to provide more details about the assembly of the InitManager class by adding an Assembly directive to the page; this directive has to know the assembly strong name, so recompile the project and retrieve U2U.ExpenseReport strong name (with Reflector for instance).
Add the Assembly directive before the page directive (don’t forget that my PublicKeyToken is different than your own):
Implement the Page_Load event handler:
protected void Page_Load(object sender, EventArgs e)
{
}
Add a new protected member that will allow us to retrieve the textbox value of the .aspx page:
public class InitManager : System.Web.UI.Page
{
protected TextBox TextBoxManager;
Add the corresponding using directive :
using System.Web.UI.WebControls;
Modify the Page_Load event handler to display the manager: protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
Response.Write("hello, the submitted manager is " +
TextBoxManager.Text);
}
}
Specify that the aspx page is the Initialization Form:
in the workflow.xml file, remove the <Instantiation_FormURN> in <MetaData>.
Modify the InstantiationUrl:
InstantiationUrl="_layouts/InitManager.aspx"
Modify the install.bat file to copy the aspx form(s) to the Layouts directory:
xcopy /s /Y *.aspx "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\"
Build the solution, call install.bat and test the workflow; the instanciation form should show up and when we click on the submit button whe should have a feeback.
Linking the form to the workflow
We want the workflow to be started when we click on the submit button.
We won’t interact directly with the workflow Runtime in Sharepoint but we interact with the site collection workflow manager (SPWorkflowManager class).
Here is the pseudo-code:
Web.Site.WorkflowManager.StartWorkflow(<listItem>, <associationTemplate>, <InitializationData>);
When Sharepoint will call our Initilialization form, it will provide some useful parameters :
· Request.QueryString["List"] which contains the List Guid.
· Request.Params["TemplateID"] which contain the association Guid.
· Request.Params["ID"] which contains the ListItem Guid.
Define the following members in the InitManager class:
And the corresponding using directives:
Upgrade the Page_Load code:
Rebuild, call install.bat and test the workflow.
Serializating the Initialization form data
Usually the iitialization form has several controls; the form data must be serialized in Xml and provided to the workflow.
Create a new class to encapsulate the Initialization form data:
Add a new helper class, AspxHelpers, with the following static methods:
In InitManager, add a new data member:
public class InitManager : System.Web.UI.Page
{
…
private InitFormData _initData = new InitFormData();
Upgrade the Page_Load event handler to serialize the form data and to start the workflow:
We need to upgrade the section of the workflow code which deserializes the data coming from the Initialization form.
Select the workflow in the Workflow Designer; double click on the first activity (onWorkflowActivated1) and replace the existing deserialization code with the following one:
Rebuild the solution, call install.bat and test the workflow.
[24/11/2008]Update : I cover aspx association forms in step 14 with much more details.
This hands-on training is the property of Redwood S.L sprl and may not be organized in class or in group without the prior written permission of Serge Luca. Should you wish to organize this hands-on training in your company or institution, please contact Serge Luca first to enter into a licence agreement. Each trainer or teacher using this hands-on training should have a licence agreement. Please ask your trainer or Serge Luca whether he or she has entered into a licence agreement with Redwood S.L sprl. The hyperlink to this hands-on training may be placed on your website for free, on the condition that the name Serge Luca is clearly mentioned in the reference. Please send us a mail containing the link to the web page our reference is used on.
August 02 Download my samples from My Windows Live FoldersIt seems that my Microsoft Live Folders account has been activated during my holidays; great opportunity to test it by uploading my samples there;
Here is the link.
back from vacationI'm finally back from vacation after being away for 2 weeks in Tunisia.
I still have to read my 440 e-mails before getting back to work.
|
|
|