Sue Hernandez's Blog

December 23, 2009

Conversion failed when converting date and/or time from character string

Filed under: SQL — suehernandez @ 4:15 pm

When attempting to write a SQL Query to insert into a database, I was using something like the following statement below:

string sql = "INSERT INTO PurchaseRequest (ProjectGroupNumber, OrderType, DateRequested) ";
sql += " VALUES ('?', '?', '?')";

SqlCommand cmd = new SqlCommand(sql, conn);

cmd.Parameters.Add(new SqlParameter("@ProjectGroupNumber", _purchaseRequest.GeneralInformation.ProjectGroupNumber));
cmd.Parameters.Add(new SqlParameter("@OrderType", _purchaseRequest.GeneralInformation.OrderType));
cmd.Parameters.Add(new SqlParameter("@DateRequested", _purchaseRequest.GeneralInformation.DateRequested.Value.ToString()));

I would always get the following:

Could Not Insert into DB: System.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.

I found the solution to be use named parameters

string sql = "INSERT INTO PurchaseRequest (ProjectGroupNumber, OrderType, DateRequested) ";
sql += " VALUES (@ProjectGroupNumber, @OrderType, @DateRequested)";

SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add(new SqlParameter("@ProjectGroupNumber", _purchaseRequest.GeneralInformation.ProjectGroupNumber));
cmd.Parameters.Add(new SqlParameter("@OrderType", _purchaseRequest.GeneralInformation.OrderType));
cmd.Parameters.Add(new SqlParameter("@DateRequested", _purchaseRequest.GeneralInformation.DateRequested.Value));

August 27, 2009

SPS 2003 with SharePoint Designer Data View

Filed under: SharePoint Designer — suehernandez @ 8:20 pm

“The server for the data source returned a non-specific error when trying to execute your query.  Check the format and content of your query and try again.  If the problem persists, contact the server administrator.”

I am logged in to SharePoint Designer as a test account that has administrative rights to the site in question.  I can’t even “Show Data” on the SharePoint List (any of them) – I get the error above.

Further, logging in as a Site Collection Administrator does not solve this problem.  However, logging in as a Domain Administrator account with rights all over the place, it works without a hitch.

Please help if you know of any solutions – please comment on this post.

Thanks
Sue Hernandez

July 7, 2009

MOSS – SPGridView with CheckBox Column

Filed under: MOSS, SPGridView — Tags: , , — suehernandez @ 12:43 am

In this article, we will explore using the SPGridView control, and adding an editable checkbox column, with JavaScript that allows us to “Select All”.   The full code is at the bottom of the article. I used the WSPBuilder tool to create the project and add the Solution information (i.e. the Feature File, elements file, etc) automatically.

In this example, we have a user cleanup task; we have a list of domain account names that have matching domain account names in another domain.  The stored procedure does the heavy lifting, in examining the account names and determining if there are “matches” based on a set of criteria.  A Requesting user will input their account name, and press Search, and then they will get a list of all users who are members of every site on which the Requesting user has administrative access.  So in short, all their users for their sites they admin.  We will then give them a button which, when clicked, will perform some action on these users, as long as they are checked.

NOTE:  In this article, we will not explore putting the grid in Edit mode, nor paging, nor sorting.  Please read the reference articles for some good tips.

References

First of all, there are many good articles out there explaining the need to instantiate the SPGridView control in the CreateChildControls method, and to set your databinding in the OnLoad event, as long as the page is not posting back.

protected override void CreateChildControls()
  {
   if (!_error)
   {
    try
    {
     base.CreateChildControls();

     // Add spacer
     this.Controls.Add(new LiteralControl("<br />"));

     // Add TextBox and Search Button
     txtUserName = new TextBox();
     this.Controls.Add(txtUserName);
     cmdSearch = new Button();
     cmdSearch.Text = "Search";
     cmdSearch.Click += new EventHandler(cmdSearch_Click);
     this.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;"));
     this.Controls.Add(cmdSearch);

     // Add spacer and Select All
     this.Controls.Add(new LiteralControl("<br /><br />"));
     this.Controls.Add(new LiteralControl("<a href='javascript:SelectAllCheckBoxes();'>Select/Deselect All</a><br />"));

     // Add GridView
     gridView = new SPGridView();
     CreateBoundFields(ref gridView);
     this.Controls.Add(gridView);

     // Add spacer
     this.Controls.Add(new LiteralControl("<br />"));

     // Add Submit Button
     cmdSubmit = new Button();
     cmdSubmit.Text = "Submit";
     cmdSubmit.Click += new EventHandler(cmdSubmit_Click);
     cmdSubmit.OnClientClick = "return confirm('Are you sure?');";
     this.Controls.Add(cmdSubmit);

     // Add Javascript
     this.Controls.Add(GetJavaScript());
    }
    catch (Exception ex)
    {
     HandleException(ex);
    }
   }
  }
 

Here, we first add a text box and a Search button, so that our user may input an Active Directory account name, which will be used in the data binding when we call the stored procedure.  We add an anchor tag with a javascript function, which is what we’ll use to toggle between Selected and Unselected.   Next we instantiate the SPGridView.  Notice that we did not set the variable here – the variable is in the private variable section, but we don’t instantiate until we get into CreateChildControls.  After that, we add our “Submit” button, which will perform whatever action you want to perform on all of the checked items.  Finally, we add a Literal Control that holds our JavaScript Toggle function.  We use the gridView.ClientID in the JavaScript to identify which input tags are actually the checkboxes that we want to toggle.

The CreateBoundFields method is where we set up our binding, for as it turns out, you always have to set SPGridView.AutoGenerateColumns to false and manually bind the columns to your data source.

  private void CreateBoundFields(ref SPGridView gridView)
  {
   gridView.Columns.Clear();
   gridView.AutoGenerateColumns = false;

   //CheckBoxField cbField = new CheckBoxField();
   //cbField.DataField = "Checked";
   //cbField.HeaderText = "Include";
   //gridView.Columns.Add(cbField);

   TemplateField checkboxCol = new TemplateField();
   checkboxCol.HeaderText = "Include";
   // Call our custom template here
   checkboxCol.ItemTemplate = new CustomSPGridViewTemplate(ListItemType.Item, "Select Item");
   gridView.Columns.Add(checkboxCol);

   BoundField colName = new BoundField();
   colName.DataField = "AccountName";
   colName.HeaderText = "Account Name";
   gridView.Columns.Add(colName);

   colName = new BoundField();
   colName.DataField = "MatchingAccountName";
   colName.HeaderText = "Matching Account Name";
   gridView.Columns.Add(colName);

  }

Notice that I have a commented out section here.  I had originally used a CheckBoxField type and that worked just fine in a sense.  However, number one, it was bound to my data source, so I actually had to create a data table with a “Checked” column in it, and two, you have to enable editing of the SPGridView.  In other words, to change the checkbox column from checked to unchecked or vice versa, you actually had to put the whole row in edit mode (post back), click the checkbox, then update the row (post back).  I just wanted a simple checkbox column that I could easily just check…check…check.

So here what we do, is we actually create a custom Class, inheriting from the ITemplate interface.  I called it CustomSpGridViewTemplate in this case, just like in the article I referenced at the top.  Now contrary to what I think is stated in that article, I am simply instantiating this TemplateField in code, and it’s not giving me any problems, probably because I have not enabled Paging or Sorting.

In the CustomSPGridViewTemplate class, we simply tell the Template what to put when it’s in Header mode, and what to put when it’s in ListItemType mode.  

public class CustomSPGridViewTemplate : ITemplate
 {
  private ListItemType templateType;
  private string columnName;

  public CustomSPGridViewTemplate(ListItemType type, string column)
  {
   this.templateType = type;
   this.columnName = column;
  }

  #region ITemplate Members

  public void InstantiateIn(Control container)
  {
   Literal lc = new Literal();
   switch (templateType)
   {
    case ListItemType.Header:
     lc.Text = "<b>" + columnName + "</b>";
     container.Controls.Add(lc);
     break;
    case ListItemType.Item:
     CheckBox checkBox = new CheckBox();
     checkBox.Checked = true;
     checkBox.ID = "CustomCheckboxID";
     checkBox.Visible = true;
     container.Controls.Add(checkBox);
     break;
   }
  }

  #endregion
 }

When the user clicks the submit button, we simply iterate through the GridViewRowCollection of the SPGridView.  The first cell will be the checkbox column in this example, so we simply get the first control in that cell and cast it as a CheckBox object.  Then we can tell if it’s checked or unchecked.  Next, I also output the text that was in the next cell, which contains my list of domain Account Names.

  private void cmdSubmit_Click(object sender, EventArgs e)
  {
   this.Controls.Add(new LiteralControl("<br><br>Submit Pressed"));

   foreach (GridViewRow row in gridView.Rows)
   {
    CheckBox cb = row.Cells[0].Controls[0] as CheckBox;
    this.Controls.Add(new LiteralControl("<br>" + cb.Checked.ToString() + " " + row.Cells[1].Text));
   }
  }

Finally, we output our JavaScript.

private LiteralControl GetJavaScript()
  {
   StringBuilder sb = new StringBuilder();

   sb.Append("\n\n");
   sb.Append("<script language='javascript'>\n");
   sb.Append("   function SelectAllCheckBoxes() \n");
   sb.Append("   { \n");
   sb.Append("      var checkboxes = document.getElementsByTagName('input'); \n");
   sb.Append("      for(var i=0; i<checkboxes.length; i++) \n");
   sb.Append("      { \n");
   sb.Append("         // Look for a CheckBox \n");
   sb.Append("         var checkbox = checkboxes[i]; \n");
   sb.Append("         \n");
   sb.Append("         // Verify it's the right name \n");
   sb.Append("         var start = '" + gridView.ClientID + "'; \n");
   sb.Append("         var end = 'CustomCheckboxID'; \n");
   sb.Append("         var startsWith = checkbox.id.match('^'+start)==start; \n");
   sb.Append("         var endsWith = checkbox.id.match(end+'$')==end; \n");
   sb.Append("         \n");
   sb.Append("         // Make the switch \n");
   sb.Append("         if(startsWith && endsWith) \n");
   sb.Append("         { \n");
   sb.Append("            checkbox.checked = !checkbox.checked; \n");
   sb.Append("         } \n");
   sb.Append("      } \n");
   sb.Append("   } \n");
   sb.Append("</script>\n");

   return new LiteralControl(sb.ToString());
  }

We first iterate through all elements with a tag name of “input”.  I want to ensure that we have the right checkboxes, so I do a string comparison – I ensure that it starts with the ClientID of the SPGridView Control, and that it ends with the control name that I specified in the custom Class, in this case “CustomCheckboxID”.  If it matches that criteria, I simply toggle the checkbox from checked to unchecked or vice versa.  I could also have done something like looked at the link we clicked and if it said “Select All” , to make sure all the checkboxes were checked, and then change the link’s text to “Deselect All”. 

Following is the full code that the article references.

 [Guid("5cd4210a-6816-4ec2-959e-78b01347df8c")]
 public class MultiDomainUserMatchup : Microsoft.SharePoint.WebPartPages.WebPart
 {
  private bool _error = false;
  private SqlDataReader rdr = null;
  private SPGridView gridView;
  private Button cmdSubmit;
  private Button cmdSearch;
  private TextBox txtUserName;

  public MultiDomainUserMatchup()
  {
   this.ExportMode = WebPartExportMode.All;
  }

  #region Overrides and Event Handlers

  /// <summary>
  /// Create all your controls here for rendering.
  /// Try to avoid using the RenderWebPart() method.
  /// </summary>
  protected override void CreateChildControls()
  {
   if (!_error)
   {
    try
    {
     base.CreateChildControls();

     // Add spacer
     this.Controls.Add(new LiteralControl("<br />"));

     // Add TextBox and Search Button
     txtUserName = new TextBox();
     this.Controls.Add(txtUserName);
     cmdSearch = new Button();
     cmdSearch.Text = "Search";
     cmdSearch.Click += new EventHandler(cmdSearch_Click);
     this.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;"));
     this.Controls.Add(cmdSearch);

     // Add spacer and Select All
     this.Controls.Add(new LiteralControl("<br /><br />"));
     this.Controls.Add(new LiteralControl("<a href='javascript:SelectAllCheckBoxes();'>Select/Deselect All</a><br />"));

     // Add GridView
     gridView = new SPGridView();
     CreateBoundFields(ref gridView);
     this.Controls.Add(gridView);

     // Add spacer
     this.Controls.Add(new LiteralControl("<br />"));

     // Add Submit Button
     cmdSubmit = new Button();
     cmdSubmit.Text = "Submit";
     cmdSubmit.Click += new EventHandler(cmdSubmit_Click);
     cmdSubmit.OnClientClick = "return confirm('Are you sure?');";
     this.Controls.Add(cmdSubmit);

     // Add Javascript
     this.Controls.Add(GetJavaScript());
    }
    catch (Exception ex)
    {
     HandleException(ex);
    }
   }
  }

  /// <summary>
  /// Ensures that the CreateChildControls() is called before events.
  /// Use CreateChildControls() to create your controls.
  /// </summary>
  /// <param name="e"></param>
  protected override void OnLoad(EventArgs e)
  {
   if (!_error)
   {
    try
    {
     base.OnLoad(e);
     this.EnsureChildControls();

     // Your code here...
     if (!Page.IsPostBack)
     {
      BindGrid("AKG\noUser");
     }
    }
    catch (Exception ex)
    {
     HandleException(ex);
    }
   }
  }

  /// <summary>
  /// Submit Button event handler
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void cmdSubmit_Click(object sender, EventArgs e)
  {
   this.Controls.Add(new LiteralControl("<br><br>Submit Pressed"));

   foreach (GridViewRow row in gridView.Rows)
   {
    CheckBox cb = row.Cells[0].Controls[0] as CheckBox;
    this.Controls.Add(new LiteralControl("<br>" + cb.Checked.ToString() + " " + row.Cells[1].Text));
   }
  }

  /// <summary>
  /// Search Button Event Handler
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void cmdSearch_Click(object sender, EventArgs e)
  {
   BindGrid(txtUserName.Text);
  }
  #endregion

  #region GridView Helper

  private void CreateBoundFields(ref SPGridView gridView)
  {
   gridView.Columns.Clear();
   gridView.AutoGenerateColumns = false;

   //CheckBoxField cbField = new CheckBoxField();
   //cbField.DataField = "Checked";
   //cbField.HeaderText = "Include";
   //gridView.Columns.Add(cbField);

   TemplateField checkboxCol = new TemplateField();
   checkboxCol.HeaderText = "Include";
   // Call our custom template here
   checkboxCol.ItemTemplate = new CustomSPGridViewTemplate(ListItemType.Item, "Select Item");
   gridView.Columns.Add(checkboxCol);

   BoundField colName = new BoundField();
   colName.DataField = "AccountName";
   colName.HeaderText = "Account Name";
   gridView.Columns.Add(colName);

   colName = new BoundField();
   colName.DataField = "MatchingAccountName";
   colName.HeaderText = "Matching Account Name";
   gridView.Columns.Add(colName);

  }

  #endregion

  #region Bind Data

  private void BindGrid(string input)
  {
   // Get Data Fresh
   SqlConnection connection = new SqlConnection("Data Source=YourServer;Initial Catalog=YourDatabaseName;User ID=YourUser;Password=YourPassword");
   SqlCommand cmd = new SqlCommand("lkp_YourStoredProcedure", connection);
   cmd.CommandType = System.Data.CommandType.StoredProcedure;

   cmd.Parameters.Add(new SqlParameter("@userName", CleanInput(input)));

   try
   {
    connection.Open();
    rdr = cmd.ExecuteReader();

    if (rdr != null)
    {
     if (rdr.HasRows)
     {
      gridView.DataSource = rdr;
      gridView.DataBind();
     }
    }
   }
   finally
   {
    try { connection.Close(); }
    catch { }
   }
  }

  #endregion

  #region Helpers

  /// <summary>
  /// Clean the input of a text box for use in SQL Parameter
  /// </summary>
  /// <param name="input"></param>
  /// <returns></returns>
  private string CleanInput(string input)
  {
   // Clean the input for SQL Injection
   return input.Replace("'", "''");
  }

  /// <summary>
  /// Get page Javascript
  /// </summary>
  /// <returns></returns>
  private LiteralControl GetJavaScript()
  {
   StringBuilder sb = new StringBuilder();

   sb.Append("\n\n");
   sb.Append("<script language='javascript'>\n");
   sb.Append("   function SelectAllCheckBoxes() \n");
   sb.Append("   { \n");
   sb.Append("      var checkboxes = document.getElementsByTagName('input'); \n");
   sb.Append("      for(var i=0; i<checkboxes.length; i++) \n");
   sb.Append("      { \n");
   sb.Append("         // Look for a CheckBox \n");
   sb.Append("         var checkbox = checkboxes[i]; \n");
   sb.Append("         \n");
   sb.Append("         // Verify it's the right name \n");
   sb.Append("         var start = '" + gridView.ClientID + "'; \n");
   sb.Append("         var end = 'CustomCheckboxID'; \n");
   sb.Append("         var startsWith = checkbox.id.match('^'+start)==start; \n");
   sb.Append("         var endsWith = checkbox.id.match(end+'$')==end; \n");
   sb.Append("         \n");
   sb.Append("         // Make the switch \n");
   sb.Append("         if(startsWith && endsWith) \n");
   sb.Append("         { \n");
   sb.Append("            checkbox.checked = !checkbox.checked; \n");
   sb.Append("         } \n");
   sb.Append("      } \n");
   sb.Append("   } \n");
   sb.Append("</script>\n");

   return new LiteralControl(sb.ToString());
  }

  /// <summary>
  /// Clear all child controls and add an error message for display.
  /// </summary>
  /// <param name="ex"></param>
  private void HandleException(Exception ex)
  {
   this._error = true;
   this.Controls.Clear();
   this.Controls.Add(new LiteralControl(ex.Message));
  }

  #endregion
 }

 public class CustomSPGridViewTemplate : ITemplate
 {
  private ListItemType templateType;
  private string columnName;

  public CustomSPGridViewTemplate(ListItemType type, string column)
  {
   this.templateType = type;
   this.columnName = column;
  }

  #region ITemplate Members

  public void InstantiateIn(Control container)
  {
   Literal lc = new Literal();
   switch (templateType)
   {
    case ListItemType.Header:
     lc.Text = "<b>" + columnName + "</b>";
     container.Controls.Add(lc);
     break;
    case ListItemType.Item:
     CheckBox checkBox = new CheckBox();
     checkBox.Checked = true;
     checkBox.ID = "CustomCheckboxID";
     checkBox.Visible = true;
     container.Controls.Add(checkBox);
     break;
   }
  }

  #endregion
 }

June 25, 2009

SPTechCon Boston – Day 3

Filed under: Uncategorized — Tags: , — suehernandez @ 11:26 am

A Good conference, all in all.   I enjoyed days 2 and 3 most, as per my previous posts, and day 2 was my favorite, but day 3 had its high points as well.

On day 3 I started with “Tapping Into your Line-of-Business App with SharePoint BDC” by Fabian Williams.  We went through the various parts of the application definition file, and I learned that if you set up filter descriptors in the app def file, the BDC List web part automatically gives you filter choices.  We also learned that, although you should not do it, theoretically you could write custom actions (custom .net code) to write back into the database.  Again, though, Fabian stressed that the BDC was meant to be a window into the LOB data, and was not for updating the LOB data.

I also attended “Customizing SharePoint Search” by John Ross.  This was more of an end-user course, as no code was involved; however I got ideas that I had not previously thought of.  For instance I did not realize that you could fully customize the display of the Core Search Results web part with XSLT.

Next was “Development Strategies for SharePoint – Declarative vs. Imperative” with Maurice Prather.  This one was good – I learned you could declare new content types completely through XML with no code involved.  The discussion was focused mainly on what is the line between all XML and all Code.  Conclusion – you can’t get away from XML but there are tons of things you can do with code that will, for example, make it so that you don’t really have to write a site definition.

Another session was “Into the Wild – The Challenges of Customized SharePoint Apps in Release” by Andreas Grabner.  Unfortunately, this was mostly a sales pitch, but even so I got lots out of it.  Contrary to what I thought the talk was going to be about, Andreas talked purely about performance issues, and how bad coding can greatly contribute to your performance problems.  I learned good tips and tricks and good coding practices, and not a few Dont’s.

Last session was “Features and Solutions: Packaging SharePoint Functionality and Content” with Darrin Bishop.  This session was good, although I had kind of been through most of what he taught.  It was a good refresher course, and I learned about more things that could be installed through features and solutions.  I also learned more of the difference between the Scopes (i.e. Farm, Web App, Site and Web).

All in all, as I said it was a very good conference, and I’m going to bring back lots of coding tricks – especially what to avoid – and how to make absolutely sure all of my objects are disposed properly.  I learned I’m going to have to resort to using CAML and the SPQuery object on lists instead of iterating through list items, which I had actually heard once before.

I’m on my way home, tired but happy.

June 24, 2009

SPTechCon Boston Day 2 – a Great Day

Filed under: Uncategorized — Tags: , — suehernandez @ 12:28 am

Today at Boston’s SPTechCon was much better for me – I went to courses much more suited to my tastes. 

First was the talk “Developing SharePoint Solutions with Silverlight” with Bob German.  This one course for me was worth the whole trip.  He talked about how to code for Silverlight using a custom Web Part, and what logic you put where.  It was an interesting and valid concept that he stated to put as much of the first-pass data retrieval as you can in your Web Part code, and pass this in to your Silverlight web part, either via the InitParams, or into a hidden field on the page (and pass the control ID of the hidden field via InitParams).  He even showed us how to code a Field Control so that in Edit Mode in the web part page, his Silverlight control was displayed and functional.

I also attended “SharePoint Workflow Alternatives for Developers” with Gary Blatt.  He was hilarious, and gave an interesting talk on how to use OOB workflows with custom lists and custom Event Handlers to simulate a workflow.  I don’t know that I’d ever need to go that route, but I was happy to be in the class and to get a little more perspective on what Event Handlers can do.

There was “A Tour of Development Governance” with Robert L Bogue.  This was wonderful – he talked about best practices and design patterns – what to use when.  He spent 9 slides – out of something like 24 – JUST on disposing your objects and more importantly why this is so important to do.

Finally, I attended Advanced InfoPath with Larry Riemann.  I think everyone was tired at that point, because the presentation went a little slow was too low-key.  There were some good tips and tricks I learned from the presentation, especially with developing InfoPath forms through Visual Studio and not Tools for Apps.  I had hoped a little more in-depth would be covered than it was, but hey what can you do in only and hour and 15.

All in all, I had a very good day today, and I’m happy about attending the conference.

June 23, 2009

A Disappointing First Day at SPTechCon

Filed under: Uncategorized — Tags: , — suehernandez @ 1:19 am

Let me first say that the speakers were fine and the material was decent.  Myself, I didn’t like the first 2 sessions that I went to.  Being a SharePoint Developer, I wanted to hit some development courses.  There weren’t many choices, at least on this first day.

I first went to “A Primer for Developing SharePoint Applications” with Kevin Israel.  Again, the speaker was fine, and the materials were appropriate.  But it was WAY too much of a Novice level course for my tastes.  I have already been developing on the SharePoint Object Model, and I figured I’d be a little above the curve, but there was a Novice course, and this was slated as an Intermediate course.  I thought I might still get something out of the course, but we basically covered stuff I was already very familiar with, such as the SPSite, SPWeb, and SPUser objects, and disposing your objects.

The second course was “Web Services and SOA in SharePoint” with Paul Swider.  He was a bit of a better speaker, but the material was a little under par, even for the audience it targeted.  The main focus of the seminar revolved around “taking a tour” of the web services, which I can do myself.  There were very little tips and tricks, or best practices, although he did mention something about Artifact development versus Assembly development which I have to look up.

All in all, I’m just waiting for tomorrow’s break out sessions.

June 11, 2009

MOSS – WSPBuilder and Workflow Template

Filed under: MOSS, Workflow — Tags: , , — suehernandez @ 7:50 pm

I am a big fan of using WSPBuilder for building Solution packages.  I did, however find one bug that others have found and blogged about also.

First of all, I was working on my company’s PC which does not have SharePoint installed.  That had problems of its own:  I had to get some dll’s on to my local computer, and register them in the GAC, for

  • microsoft.office.workflow.tasks.dll
  • Microsoft.SharePoint.dll
  • microsoft.sharepoint.WorkflowActions.dll
  • microsoft.sharepoint.WorkflowActions.intl.dll
  • microsoft.SharePoint.workflowactions.intl.resources.dll

The last one, I had to get directly out of the GAC from a server that had SharePoint on it, by navigating to

    C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint.WorkflowActions.intl.resources\12.0.0.0__71e9bce111e9429c

Now, as for WSPBuilder, when adding a new project of type “WSPBuilder Project with Workflow”  I found that once I deployed the solution I kept getting the result “Failed on Start”.  When I looked into the SharePoint log files, it showed ”Workflow Failed Validation” type of exceptions.

Turns out accofding to This Post that the project file needed an extra line – a missing import target.  Below the line

    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

we need to add the line

    <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

This solved the problem, and the workflow then proceeded to fail miserably in expected ways as opposed to unexpected ways :-) .  Until I fixed it of course.

MOSS VPC – Publishing from Infopath 2007 URL Not Valid

Filed under: InfoPath, MOSS — Tags: , , — suehernandez @ 7:33 pm

For some reason when you’re in a Virtual PC that is not on the network, and you try to publish an InfoPath Form to your server, you receive a “URL Not Valid” error.

This is due to the System Event Notification Service checking the network status.  A trick is to type in

    net stop sens

in a command window, and then deploy your template.

 

Reference:  http://jopx.blogspot.com/2006/08/having-problems-with-moss-2007-in.html

May 22, 2009

MOSS: Service Pack 2 activates 180-day expiration

Filed under: MOSS — Tags: , , , — suehernandez @ 3:27 pm

According to Twitter and the Microsoft SharePoint Team Blog (http://blogs.msdn.com/sharepoint/archive/2009/05/21/attention-important-information-on-service-pack-2.aspx ):

“During the installation of SP2, a product expiration date is improperly activated. This means SharePoint will expire as though it was a trial installation 180 days after SP2 is deployed. The activation of the expiration date will not affect the normal function of SharePoint up until the expiration date passes. Furthermore, product expiration 180 days after SP2 installation will not affect customer’s data, configuration or application code but will render SharePoint inaccessible for end-users.”

There is a hotfix as well as a workaround for this, all on the MS SP Blog link above.

MOSS: Web Part Pages – Where is my Quick Launch Bar?

Filed under: MOSS, Quick Launch Bar, Web Part Pages — Tags: , , — suehernandez @ 3:14 pm

When you create a new Web Part Page, you will notice that it by default has no Quick Launch bar.

To put the quick launch bar back in, it is as simple as opening up SharePoint Designer and deleting three lines of code:

<asp:Content ContentPlaceHolderId=”PlaceHolderPageImage” runat=”server”></asp:Content>
<asp:Content ContentPlaceHolderId=”PlaceHolderLeftNavBar” runat=”server”></asp:Content>
<asp:Content ContentPlaceHolderId=”PlaceHolderNavSpacer” runat=”server”></asp:Content>

Simply remove those three lines and save the page. You now have your quick launch bar back.

Older Posts »

Blog at WordPress.com.