Skip to content

Diagnostics Logging for Windows SharePoint Services V3

Somewhere along the journey of beta cycles Dan Winter made me realize how important the logs in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS directory was.  In that case we were dealing with a setup issue and we were looking for the PSCDiagnostics*.log files.  However, I didn’t associate that directory with logging for the entire product.  So when I started struggling with workflows (see my two previous posts: Adding the second workflow to a SharePoint Workflow Assembly and Renaming the Default Workflow with the ECM Starter Kit B2TR) I didn’t connect that the unified logging service would have the answers I needed.  However, Todd Baginski was kind enough to remind me that these logs actually contained everything SharePoint in them.  When I cracked the latest log file open I saw my error.  Of course, that doesn’t resolve the problem — but it at least allows me to work on it.  So, if it’s SharePoint and it’s broken the LOGS directory is a good place to look first.

By the way, if you want to change the interval that the log files are changed or the number of log files that are kept, you can get to that under Central Administration->Operations->Diagnostics Logging.

Adding the second workflow to a SharePoint Workflow Assembly

With the  2007 Office System: Enterprise Content Management Starter Kit (ECMsk), you get a project type that will create a SharePoint aware workflow (in either sequential or state machine format.)  However, if you want more than one SharePoint workflow in the same assembly you’ve got a problem.  The ECMsk (at least in Beta2TR which is the latest publicly available version as of this writing) doesn’t add the project item type into Visual Studio so you can’t create a second workflow easily.  Great.  Here’s how to do it by hand.

  1. Create a workflow of your choice.  Choose the option indicated (code) not the one indicated (with code separation).  [Note: I used sequential workflow for my example – and technically this should be possible with code separation I just didn’t test the steps, yet.]
  2. Open the code view of your new workflow (*.cs)
  3. Add a using statements to the top of the file, after the existing using statements
  4. using Microsoft.SharePoint
  5. using Microsoft.SharePoint.Workflow
  6. using Microsoft.SharePoint.WorkflowActions
  7. Change the class to derive from SharePointSequentialWorkflowActivity instead of SequentialWorkflowActivity.
  8. Save your work and close the file.
  9. Open the design view of the workflow(*.cs [Design])
  10. Drop the onWorkflowActivated activity on the workflow surface.
  11. Double click on the onWorkflowActivated activity to create the invoked code behind.
  12. Save the file and then close the design view (*.cs [Design])
  13. Open the designer.cs file for the workflow (*.designer.cs) (It’s stacked underneath the *.cs file of the workflow by default.)
  14. Add a using statement to the top of the file after the existing using statements
  15. using Microsoft.SharePoint.Workflow;
  16. Add two variable declarations above the onWorkflowActivated1 definition
  17. public Guid workflowId = default(System.Guid);
  18. public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
  19. Expand the “Designer generated code” segment.
  20. After the line in InitializeComponent() which reads “this.CanModifyActivities = true;” add the following:
  21. System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
  22. System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
  23. activitybind2.Name = “myWorkflowName”;
  24. activitybind2.Path = “workflowId”;
  25. activitybind1.Name = “myWorkflowName”;
  26. activitybind1.Path = “workflowProperties”
  27. After the line in InitializeComponent() which reads “this.onWorkflowActivated1.Invoked += new System.EventHandler(this.onWorkflowActivated1_Invoked) add the following:
  28. this.onWorkflowActivated1.SetBinding(Microsoft.SharePoint.WorkflowActions.OnWorkflowActivated.WorkflowIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
  29. this.onWorkflowActivated1.SetBinding(Microsoft.SharePoint.WorkflowActions.OnWorkflowActivated.WorkflowPropertiesProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
  30. Save the *.designer.cs file.
  31. Open the design view of the workflow (*.cs [Design])
  32. Click on the CorrelationToken property and type ‘workflowToken’.
  33. Expand CorrelationToken and in the OwnerActivityName that appears beneath it select the name of your workflow.
  34. Save the file.
  35. You’re ready to build.  Press Ctrl-Shift-B to build – and your new workflow should just work.

Not as simple as it should be – and I have no way of knowing if this is a supported (or supportable) way of getting a standard workflow to work as a SharePoint workflow – but it’s worked thus far in my testing.

Renaming the Default Workflow with the ECM Starter Kit B2TR

I’m about neck deep with Visual Studio 2005 and SharePoint workflow right now.  (Actually, I’m breathing through a straw as you may see.)

The 2007 Office System Starter Kit: Enterprise Content Management Starter Kit (ECMsk) has in it some Visual Studio project templates to get you started with using SharePoint and Workflow together.  However, it’s in beta so it’s not perfect…

The first issue isn’t that bad, it adds a reference to Microsoft.Office.Workflow.Tasks – which isn’t installed with WSSv3 – even with Office 2007 Pro and InfoPath 2007  installed.  It means removing the reference and the using line ‘using Microsoft.Office.Workflow.Utility’ in the workflow1.cs file.   Not that big a deal all things considered.

The other problem is a bit more tangled.  That is you can’t easily rename the workflow to be something else.  If you try renaming the workflow you’ll get a friendly prompt from Visual Studio stating “You are renaming a file.  Would you also like to perform a rename in this project of all references to the code element ‘Workflow1’?”  It’s pretty nice of it to ask so sure.  Click the Yes button.  This is where you have your first signs it’s going to be ugly.  Visual Studio’s next dialog states: “Your project or one of its dependencies does not currently build.  References may not be updated.  Continue: Perform the refactoring, Preview: Show a preview of the references that will be updated, Cancel: Cancel the refactoring” followed by a helpful “Show this dialog every time” checkbox and the option to continue, preview, or cancel.  You can click continue, but it’s right.  Not all the references were updated.

If you open the newworkflowname.designer.cs (*.designer.cs) file for the workflow you’ll find a section of code marked “do not touch” – said only in a slightly nicer way.  In that section you’ll find an InitializeComponent() method.  It contains four references to the old workflow1 (and a comment) – all in text references.  A quick search and replace and the rename will be complete.  However, there’s one little catch.  You must have the Design view of the newworkflowname.cs file (*.cs [Design]) closed in order for your changes to be recorded.  Make sure you do that before the search and replace.  Do a save then a Ctrl-Shift-B to build and see if it builds for you.

Easy as pie, right?

Connect the Dots: Developing Products

Let me start in a rather odd way.  I don’t have all the answers about developing products.  Frankly, I probably have only the slightest sliver of understanding of what is needed to develop products.  Having been stuck at the phase where I have completed products that I haven’t been able to release to the market – I’m focused on thinking about the problem and trying to find solutions.

My son is at the stage where he likes dot-to-dot puzzles.  He connects each dot not knowing what the end result will be.  He carefully connects one dot and then the next and then the next and doesn’t take the time to step back until he’s completed.

It strikes me that this isn’t much different than the process of creating a product.  I realize that there are lots of dots – most of which need to be connected – to make the complete picture – the product.  I’m sure (because I’ve not managed to make my product sales what I would call successful) that I’m missing a few, but I wanted to share what I’ve figured out thus far.

Developing the Product

Perhaps the easiest part of the process for me is developing the solution.  I’ve spent the last 15 years of my professional career creating solutions for clients.  Writing the program and understanding how to make it reusable isn’t something I really struggle with any more.  If you look in my source control system you’ll find dozens of testing harnesses and tools designed to perform reusable operations – and that doesn’t even include the things that I’ve packaged to be products.

Documentation

Also in the easy category for me is writing.  I’ve spent the last several years writing articles and books.  Writing isn’t something I dread (very often).  It’s just another thing to do.  Once I have working and tested code, it’s off to write some documentation that will help people understand how to use it.  The trick here, if there is one, is writing the documentation to spark the user’s creativity on how the tool can solve problems other than the one it was intended to solve.

Installation Package

Ouch.  This one hurts.  Every experience I have had making anything but the most trivial installation package has ended in disaster.  However, a good solution to the need to get the software installed is an essential part of the overall solution.  I bias strongly towards programs that require little or no installation – but that’s honestly because my experience with installers has been so bad.

Licensing

Somewhere in this process you have to integrate a licensing engine.  As much as I hate to say it software piracy runs rampant in the world.  People don’t quite understand the intellectual property which is wrapped up in the software and the need to compensate the author for that intellectual property.  I like to ignore this but I’m painfully reminded by my friends and colleagues that I cannot.

Store Front

I learned that in the publishing world there’s not a lot that matters other than shelf space.  Good authors, good books, and good ideas have died a slow death because they were never provided the shelf space in the book stores that they required.  A product is the same way.  The product needs a home.  It needs a place for people to come to find it.  It needs a place that describes it and explains how it works, what the values are, and the cost.  Without this place no one will know the product exists – or they won’t be able to find it if they do know it exists – and you won’t get any sales.

By the way, this is the point where I’m stuck.  I, in part, build commercial grade eCommerce solutions for large organizations.  My threshold for the system to deliver my products is really, really high.  That means that some of the traditional options for Micro-ISVs just don’t just make me feel comfortable presenting my solutions there.  I haven’t yet invested the time to get my platform up and running personally… so I am stuck.

Commerce Enabled

Once you have a store front and people have a way to know that they want to buy the solution, it’s important that you have a way to take their money.  Honestly, this part has become much simpler over the last few years.  With credit card processors owned by large banks now supporting web service calls to authorize transactions, and the services offered by PayPal, there are real options for conducting commerce over the web.  Credit Cards are not quite universal; however, they are pervasive enough that they are an effective payment mechanism.  The real challenges here are managing fraud and dealing with “returns.”

Support

Supporting a product once it’s in the market is critical to long term success, but how does a small software vendor cope with the time that supporting customers requires?  Support is one part about preparing – so you can track defects, customer satisfaction, etc., but more than anything else it is about creating and preserving timely communications with the users trying to use the product.  Not an easy task for most organizations.  Perhaps this is why so many software companies struggle with support today.

Marketing

Build it and they will come doesn’t work.  You need to let people know that your product exists.  For most folks this means buying advertising.  It is money out of your pocket to get people to look at, think about, and perhaps even evaluate your product.  The folks that I know who are successful at selling products all talk about how their advertising relates to product sales.  They don’t see a one-to-one relationship – but they definitely see an impact on sales.  So your product (and perhaps your company) needs some sort of a marketing strategy.

v.NEXT

The final part of developing a product is developing a lifecycle for the product.  What will the next version of the product do?  When will you make the investment in the next version of the product?  Planning for the next revision is as much a part of the total solution as any other part of the process.

Conclusion

I don’t know what all of these dots make when connected.  I’m pretty sure it’s not a bunny rabbit, but beyond that I haven’t a clue what to expect.  When you’re looking at putting together a product ask yourself if you can connect all of these dots – or not.

Multiplying pages in the SharePoint database — but not on the file system

Most people don’t realize that a SharePoint site can have multiple pages.  Somehow in the mind of the user the idea that a SharePoint site is a collection of pages is limited to being able to recognize the pages in a list as a part of the site.  However, there may be times when multiple pages make sense — for instance, different dashboards for the same site.  One might summarize a project overall, another might expose schedule performance, another handles detailed financial performance, etc.

Once you get past the barrier that you can have multiple pages — how do you get them?  You add additional pages to a site (if you want them to be ghosted) by adding <File> nodes in the <Module> nodes of the ONET.XML file.  That might look something like this:

<File Url=”page01.aspx” NavBarHome=”True” Type=”Ghostable” />

Not too bad but why create extra files on the file system — this would require that you copy default.aspx to page01.aspx.  If you add one more attribute and end up with …

<File Url=”page01.aspx” NavBarHome=”True” Type=”Ghostable” Path=“default.aspx“ />

you end up with a page reference in the database which links back to the default.aspx page.  You can therefore provision new pages for your sites which will be ghosted — without making copies of your default.aspx.  Pretty cool eh?

Article: 7 Keys to SharePoint Success

Have you wondered what makes some SharePoint projects succeed where other SharePoint projects fail? Have you wondered why your SharePoint project struggles from time to time? Have you ever wanted a roadmap to help you avoid all of the swamps and rocky terrain that seem to make SharePoint harder than it should be? SharePoint projects can be easy or difficult depending upon what you’re trying to do, the organization’s make up, and the way you manage the project. The seven keys below are designed to help you increase your chances of success as much as possible.

http://mssharepoint.advisorguide.com/doc/18491 [Website removed]

Products I Use: Targus Notebook Cooling Mobile X Stand

Taking another item in my bag is the last thing I want to do.  I have to carefully manage the weight in my carry on bag so that I don’t need a fork lift to pick it up.  So when I start looking at another item I’ll have to carry I get cautious.  However, here’s the deal.  I’ve started getting some tingling in my hands as I work on my laptop.  I moved my watch from one wrist to the other, started putting paper notebooks in front of my computer to support my arms, and all sorts of other goofy ways to make the pain stop.

I had decided that I had to live with it and be careful when working on the laptop.  I then ran into the Targus Notebook Cooling Mobile X Notebook Stand.  I got it on a whim, thinking hey, what could it hurt but I’ve got to tell you it’s made my essential list.

It’s designed to tilt the notebook up to allow it to cool, however, the tilt is just enough to make it more comfortable for me to type.  By aligning the angle of the notebook so that my arms comfortably rest on the front of the computer while typing, it’s eliminated those times when I feel pain from typing on the keyboard.  Just the little bit of angle that it adds to the notebook is enough to remove the pressure from my wrist and aparently allow blood to continue flowing to my hands.

When I’m done it folds up into a ultra small size that I can slip into one of the outside pouches on my bag.  It’s about the size of a tabletop tripod and weighs less than 6 ounces.

I suppose it helps the computer stay cool too … but I don’t really care that much about that compared to being able to type without pain.

Products I Use: Valence N-Charge VNC-130

One of the things I enjoy most is talking with other authors, speakers, MVPs, and visionaries about the things they use.  Whether it’s software, hardware, or just a technique, I find that I generally enjoy knowing how they solved a problem.  This is the first in a series of posts designed to share some of the things that I’m using that everyone may not be aware of.

One of the problems I have is battery life.  I travel with a 17” widescreen notebook (currently a Dell Inspiron E1705) that sucks batteries dry in no time flat.  When I’m traveling by air I don’t always have the luxuary of a power port.  That means I have to figure out how to get enough power for those 6 hour flights to Redmond (and other places.)

The solution for me is a Valence N-Charge VNC-130.  It’s an external battery that supplies power to the notebook just like it was coming from the standard wall adapter — but it’s battery power.  So there are three key features of the N-Charge VNC-130 that I think are must have.  They are:

  1. Dimensions — The battery is flat.  It easily slides underneath the laptop I work on so that I don’t have to worry where I’m putting it.  Other external battery options are “bricks“ that need to have their own home.  The dimensions also make it easy to slide into my computer bag.
  2. No extra charger — Another great feature is that it doesn’t require a separate charger.  The charger I already carry for the notebook is enough to charge it.  There is a limitation, I can’t use the power supply from the computer to run the computer, charge the computer’s battery and charge the N-Charge at the same time.  I can, however, charge the N-Charge system while the internal battery is already charged, or I have the system turned off.
  3. Interchangible — The system uses interchangible cords that connect the battery to the laptop which means when I change laptops I can continue to use the battery — I just have to buy a different cord to connect to the laptop.  Sure it’s $30 for the new cord, but  it’s a $300 investment to get the battery in the first place — it’s a small price to pay.

OK, I left the best for last.  How long can I get on the battery?  Hours and hours.  Even if I’ve got my system in it’s most power hungry mode, I can run for almost 4 hours.  (the internal battery lasts a little over 2 hours at these settings.)  The net effect if I use even moderate power consumption (reducing the brightness of the screen, setting the processors for dynamic CPU speed, etc.) I get well more than the 5-6 hours I need for flights across the US.

This is one of those tools that I hesitated to buy but have decided that I love now that I have it.  If you have ever traveled and not had enough power to complete your work — it’s a valuable investment

How To: Testing Host Headers (overriding DNS name resolution)

It’s come up several times in the last few weeks that I’ve needed to test a web site that was using host headers (in one form or another) but the DNS entries didn’t point to the server yet.  So I’ve had to walk some folks through the process of setting up their computer test the server.

Host headers are used by many ISPs to allow your web site and hundreds of other web sites to share one IP address.  When your web browser issues a request for a web site it goes to a specific IP address and opens a socket.  It then sends a request for the page it wants and includes the host name of the server it’s trying to reach — rather than the IP address.  Web servers can use this information to direct your request to the right web site.  The problem comes in when you want to test a site before the DNS is setup to reach it.

The magic of working around the problem lies in the %WINDIR%\System32\drivers\wayetc\hosts file.  This file is checked before DNS and is a great way to temporarily override the resolution of a name to any ip address you want.

The file has an example in the ever useful localhost entry.  You can copy this format to add in the ip address and then host name of the server you want to reach that is doing host header direction to sites.  Once the entry is made and the file is saved the changes are immediate.  You can test this at the command line by issuing a ping command and seeing that the IP address for the server is the IP address you entered into the file.

Webcast: Connecting Conversations, Requirements, Construction, and Testing

Today I had the pleasure of delivering a presentation entitled: Connecting Conversations, Requirements, Construction, and Testing to the Indianapolis Quality Assurance Associations’ symposium.  During that talk I promised to make the slides and a web cast (link removed) version of the material available.

The presentation focuses on the need to connect conversations through requirements, design, construction, and testing.  Learning how to make sure that everyone knows what they need to know — and eliminating all of the disconnects beween the different parts of the process can make software development easier, and more fun.  Learn how to eliminate those awkward situations where development builds something, quality assurance says it fails, and development insists that it matches the requirements.  It can also help you identify gaps in the requirements document before they get out of hand.

As always, I’d love to get your feedback.  Send me an email (as comment spammers have made me turn off comments.)

Recent Posts

Public Speaking