Paul Galvin's (old) SharePoint space [SharePoint

Just another WordPress.com site

SharePoint Shop Talk Tomorrow (11/12) from 12:30PM to 1:3PM EDT

My blog has moved.  Please update your bookmarks accordingly: http://www.mstechblogs.com/paul

This article has moved: http://www.mstechblogs.com/paul/sharepoint-shop-talk-tomorrow-1112-from-1230pm-to-13pm-edt

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

SharePoint Shop Talk for Thursday 11/05/09 @ 12:30PM EDT

My blog has moved.  Please updated your bookmarks accordingly: http://www.mstechblogs.com/paul

This article has moved: http://www.mstechblogs.com/paul/sharepoint-shop-talk-for-thursday-110509-1230pm-edt

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Comparing Dates in a Data View Web Part to Build a WSS KPI

My blog has moved.  Please updated your bookmarks accordingly: http://www.mstechblogs.com/paul

This article has moved: http://www.mstechblogs.com/paul/comparing-dates-in-a-data-view-web-part-to-build-a-wss-kpi

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

In Praise of jQuery Enhanced Search-As-You-Type (by Jan Tielens)

My blog has moved.  Please updated your bookmarks appropriately: http://www.mstechblogs.com/paul

This article has moved: http://www.mstechblogs.com/paul/in-praise-of-jquery-enhanced-search-as-you-type-by-jan-tielens

</end>

This is another post in my on-going series on how to use jQuery with SharePoint.
If you want to learn more about jQuery, I highly recommend: jQuery in Action by Bear Bibeault and Yehuda Katz.

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

SharePoint Shop Talk Thursday 10/29 at 12:30 PM EDT

My blog has moved.  Please update your bookmarks accordingly: http://www.mstechblogs.com/paul

This article has moved: http://www.mstechblogs.com/paul/sharepoint-shop-talk-thursday-1029-at-1230-pm-edt

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Quick Hit: Reading InfoPath XML Directly From an SPListItem in SharePoint

I’m been working on a project where I need to extract attachments from an InfoPath form.  There are some good resources for parsing InfoPath forms (which are just XML files, so it’s actually quite easy). 

While I was building up the project, I started by downloading an InfoPath form and saving it to my local hard drive.  My c# code was reading directly from that instance.  However, the InfoPath forms are really living inside a SharePoint forms library.  I did a little half hearted searching to find out how to read it directly from the library and almost gave up, in which case I would have saved the form to a local temp directory and read it from there.  However, there’s no need to go through those hoops as you can read it directly from the library.  This little snippet shows how:

/// Class definition stuff here, including:
private SPFile mySharePointFile; /* Part of an SPList */
// More code goes here and inside a method of the class we have:
XmlTextReader textReader;
textReader = new XmlTextReader(mySharePointFile.OpenBinaryStream());

textReader.WhitespaceHandling = WhitespaceHandling.None;

textReader.Read();

// If the node has value

while (textReader.Read())
{

  … and so on and so forth …

 

They key bit above is that we can read the InfoPath directly via the OpenBinaryStream() method call on the SPFile as a parameter to the constructor on XmlTextReader.  It works great.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Quick and Easy: Send Email Using Gmail SMTP Server in .NET C#

This isn’t exactly a new topic, but when I needed to do it, I found a lot of “why won’t this work for me” and not too many direct answers.  I hope someone finds this useful.

The following bit of code will send an email using my own gmail account to do it, including attachments:

using System.Net.Mail;
using System.Net;

NetworkCredential loginInfo = new NetworkCredential("[My Gmail ID]", "[My Gmail Password]");
MailMessage msg = new MailMessage();
msg.From = new MailAddress("[M Gmail Id]@gmail.com");
msg.To.Add(new MailAddress("paul.galvin@arcovis.com"));
msg.Subject = "Test infopath dev subject";
msg.Body = "<html><body><strong>A strong message.</strong></body></html>";
msg.IsBodyHtml = true;

foreach (string aFile in NIPFD.GetAttachmentNamesAndLocations())
{
    msg.Attachments.Add(new Attachment(aFile));
} // Adding attachments.

SmtpClient client = new SmtpClient("smtp.gmail.com");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = loginInfo;
client.Port = 587;
client.EnableSsl = true;
client.Send(msg);

 

A few key bits that slowed me down and other observations / notes:

  • The first line that creates the loginInfo object needs to use the gmail ID stripped of “@gmail.com”.  So, if my gmail email address is “sharepoint@gmail.com” and my password is “xyzzy” then the line would look like:

NetworkCredential loginInfo = new NetworkCredential("sharepoint", "xyzzy");

  • My gmail account is set up to use SSL and that wasn’t a problem.
  • There is some conflicting information out there on what port to use.  I used port 587 and it worked fine for me.
  • In my case, I also needed to send attachments.  That NIPFD object has a method that knows where my attachments are.  It’s returning a fully path (e.g. “c:\temp\attachment1.jpg”.  In my test, I had two attachments and they both worked fine.

I used visual studio 2008 to write this code.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags: ,,,

SharePoint Conference 2009 – Get Your Real Time Raw Data From Twitter

I expect that nearly everyone knows this anyway, but I thought I’d toss out a quick note that there’s a tremendous amount of very interesting information available via twitter.  The hash tag #SPC09 seems to be the most popular.  Like always, there’s a lot of silliness and “in” jokes, but if you can get past that, check it out.  I do my best to respond to comments or questions directed to me and I know that a lot of others do as well, so it’s not just a one-way flow of information.

New sessions start in just under two hours and continue up until about 3pm EDT this Thursday.  It will start to pick up then.

Check out the twitter feed here: http://twitter.com/#search?q=%23spc09

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Programmatically Extracting Attachments From InfoPath Forms (Including Their Names!)

I have an expense entry solution for a client that leverages InfoPath and workflow.  At one point during the approval process, I need to generate an email that has all of that good InfoPath data as well as the attachments themselves so that (sigh) someone can take that data and manually re-key it into an Oracle database application.

It’s not very difficult to get at or parse the InfoPath form.  I didn’t know how to handle the attachments, however.  After an hour or two of poking around the Internets (an eternity!) I found this article: http://support.microsoft.com/kb/892730

It provide some handy code to extract the attachment from a node in the form.  (You still need to find the node and all that, but that’s just XML parsing).

I know that the attachment is base64-encoded and I originally went down the path of just extracting the the base64 data, decoding it and saving it.  However, I quickly realized I didn’t know how to get the file name itself until I found the aforementioned article.

I had actually found that quite early, but I was put off by its split personality. On the one hand, the article *says* it’s good for InfoPath 2007.  Yet, the code and instructions are all about Visual Studio 2003 and references to InfoPath 2003.

Bottom line, the code that article provided is working well for me (so far).  I can get my InfoPath form, I can parse it, I can find and decode the attachment and I know its name.  What more can one ask of one’s life?

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags: ,,

If you’re worried that your SharePoint environment may be a tad unhealthy, let me help you fix that with a health check.

SharePoint Shop Talk Recap for 10-08-2009

Today’s SharePoint Shop Talk covered its usual wide range of topics:

  • We discussed the issues around opening up parts of a SharePoint site collection to your trading partners.  It’s not the most complicated thing in the world, but when you start talking about out loud, you realize there are a lot of small individual things that need to be done to do this correctly.  You have to consider the firewall, licensing (your intranet SharePoint license may not be, and probably won’t be, sufficient), SharePoint configuration (AAM, extending web applications to zones that probably have HTTPS enabled), etc.  If anyone has a checklist of what to do and the sequence, I’d love to see it in comments.  This question wins the “Most Discussed Question” aware of the year (so far).
  • I got to ask a question about the image library functionality that generates those thumb nail images.  I speculated that an event receiver on the image library is generating the thumb nail.  I’m probably way off base, but it does seem like there’s an entirely separate image on the web server for the thumb nail itself.  Vamshi, a SharePoint Shop Talk regular, points out this blog entry: http://pathtosharepoint.wordpress.com/2009/08/23/picture-libraries-take-advantage-of-web-friendly-formats/.  That’s a pretty interesting post about images in SharePoint if you’re interested in it.
  • We discussed custom edit forms (that you create via SPD) and the fact that you lose the attachment functionality when you do that.  Laura Rogers has blogged on that subject here: http://sharepoint911.com/blogs/laura/archive/2009/09/10/fix-for-the-custom-form-attachments-issue.aspx

This week, we introduced a new feature where we spent about 10 minutes demonstrating an interesting tip/trick in a SharePoint environment.  This week, we showed how to added a content editor web part (and actually any web part) to a newitem.aspx page.  In this case, the objective was to show some extensive online help for that newitem.aspx page.  This is also one of the usual starting points for integrating jQuery into your environment.  Next week, we do plan to show a jQuery tip/trick.  We hope to see you there. 

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags: