Friday, July 24, 2009
How to build and Deploy a Workflow with WSPBuilder
1. Download and run the WSPBuilder Extensions from CodePlex. http://www.codeplex.com/wspbuilder
2. Start a new project in Visual Studio. If you ran the WSPBuilder Extensions you should have a new option for project type. Choose a “WSPBuilder Project with Workflow” template.
3. Right click on the project and add a sequential workflow:
Choose a Sequential Workflow Feature Template
Choose Scope as Site.
4. You’ll notice you are missing references:
Change the Target framework to .Net 3.0 for the project.
5. Double click on the projectname.cs file inside the WorkflowCode folder. Drag a “logtoHistoryListActivity” from your toolbox directly beneath the onWorkflowActivated1. On the properties for logtoHistoryListActivity1, add text to the HistoryDescription and HistoryOutcome. Save and close the file.
6. Open the elements.xml file that was placed in 12/Template/Features/projectname/. Remove the following attributes inside the workflow node: TaskListContentId, AssociationURL, InstantiationURL, ModificationURL, StatusPageURL. Save that file.
7. Right click on the project and add a new item:
Add a Solution Installer Configuration:
8. Edit the Setup.exe.config file and delete the row with the FarmFeatureId. Save and close that file.
9. Right click on the project and build.
10. Right click on the project – WSP Builder – Build WSP. (This will build your wsp file)
11. Right click on the project – WSPBuilder – Create Deployment Folder.
12. Execute \%projectfolder%\bin\deploy\%projectname%\setup.exe on the target server. Your installer will come up, once you click Next it will do a system check, you can accept the end user license, and then you can choose which web applications to deploy to.
13. Logon to Sharepoint. Go to site actions – Site Settings – Modify All Site Settings
Under Site Collection Administration, click on Site collection features. Find your feature and click on Activate
14. Once the feature is active, go to a Document Library, and go to Document Library Settings.
Click on Workflow settings. Click on Add a workflow. Select your workflow, and choose other options.
15. Go back to the Document Library and start the workflow manually, or however you chose with start options.
16. Verify that the workflow completed.
Wednesday, May 20, 2009
TechEd 09 Keynote Recap
There are two questions that need to be answered...
1. How do we apply virtualization.
2. When do you run in the data center vs. in the cloud.
Windows 7 cool features include the awesome new problem step recorder. This will be a life saver for us developers! The windows snap and shake. Since I haven't played with this feature, I'm not sure if I will like it or not, but you can basically shake a window and it will snap into place. Also Windows 7 will include virtualization.
Server 2008 will run on 64 bit only. It has remote administration features, an active directory undelete option, and can search using OCR technology, so it can find words on images.
Wednesday, October 29, 2008
Alphabetize a featureset
//fset is of type esri.arcgis.gmaps.FeatureSet() returned by the QueryTask execute method
//The following alphabetizes the array
fset.features.sort(function(a,b){
var aString = a.attributes.School;
var bString = b.attributes.School;
if (aString < bString) return -1;
else if (aString > bString) return 1;
else return 0;
});
How to use Sharepoint Lists as Web Services
- First you have to figure out the GUID for your listName and viewName. How do you do that? Well the simplest way is to open up the list in Sharepoint. Open up the List Settings by clicking on Settings -> List Settings. Now look at the URL. You should see the GUID for your list Name (note it is URL encoded) Visit this link for a quick conversion tool. Now scroll down to the bottom of the page to find the views. Click to edit the View that you want the GUID for. Now look in the URL again and you will find the GUID for the viewName.
- And now, here is the code:
// Declare and initialize a variable for the Lists Web Service.
servername.Lists listService = new servername.Lists();
/* Authenticate the current user by passing their default
credentials to the Web Service from the system credential cache.
*/
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Set the Url property of the service for the path to a subsite.
listService.Url = http://servername.domain.org:portnumber/_vti_bin/Lists.asmx;
// Instantiate an XmlDocument object
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
/* Assign values to the string parameters of the GetListItems method,
using GUIDs for the listName and viewName variables*/
string listName = "{listName GUID goes here}";
string viewName = "{viewName GUID goes here}";
string rowLimit = "150";
/*Use the CreateElement method of the document object to create elements
for the parameters that use XML*/
XmlElement query = xmlDoc.CreateElement("Query");
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
/* Declare an XmlNode object and initialize it with the XML response from
the GetListItems method.*/
XmlNode nodeListItems = listService.GetListItems(listName, viewName,query,viewFields,rowLimit,queryOptions, null);
/* Declare an XmlNode object and initialize it with the XML response from
* the GetListItems method. The last parameter specifies the GUID of the Web site
* containing the list. Setting it to null causes the Web site specified by the Url
* property to be used.*/
XmlDocument xd = new XmlDocument();
xd.LoadXml(nodeListItems.OuterXml);
XmlNamespaceManager nm = new XmlNamespaceManager(xd.NameTable);
nm.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
nm.AddNamespace("z", "#RowsetSchema");
XmlNode itemCount = nodeListItems.SelectSingleNode("//rs:data/@ItemCount", nm);
if (Convert.ToInt32(itemCount.Value)==0)
Label2.Text="No values returned";
else
{
nl = xd.SelectNodes("//rs:data/z:row/@ows_Title", nm);
nlEmail = xd.SelectNodes("//rs:data/z:row/@ows_Title//rs:data/z:row/@ows_Contact_x0020_Email", nm);
nlParent = xd.SelectNodes("//rs:data/z:row", nm);
ddlAgencyList.Visible = true;
// Loop through each node in the XML response and display each item.
foreach (XmlNode listItem in nlParent)
{
for (int i=0; i< listItem.Attributes.Count; i++)
//This iterates through each Agency (the count is the number of attributes of the agency
{
if (listItem.Attributes.Item(i).Name == "ows_Title")
{
ddlAgencyList.Items.Add(new ListItem(listItem.Attributes.Item(i).Value));
}
}
}