Sandeep Khandelwal's Blog

SharePoint, ASP.net & other related stuffs

Removing InfoPath Form Attachments – Part 1

clock September 8, 2009 04:22 by author Sandeep Khandelwal

This seems to be really a hot topic based on the people trying to tackle this problem in many ways. In my 3 part article series, I would take a stab at this inherent problem with InfoPath forms (be it browser based or used via rich client).

So, First,Lets understand the problem. InfoPath with service pack 2 in 2003 onwards has added support for a new control called File Attachment control Now this control allows users to quickly attach file relating to the form.  When a user saves the form, these files gets stored inside InfoPath xml data file in a base 64 encoded format. Every time when a user opens the form, InfoPath decodes the string and shows the correct file to the users. All is good thus far. But what really happens, is that the users started uploading those gigantic 2-3 MB files which inherently makes the form slower for other users who are not interested in attachment files. Problem!!! Right.

User will come back and demand that they would like like to be able to attach and retrieve files from the InfoPath but would like to speed the retrieval process. Hmmm! There are several ways to tackle this problem.

  1. Create a SharePoint Designer Workflow and use the custom workflow that Bart has written (LINK) This works nice, but only processes 1 file attachments. What if you have file attachment control inside a repeating table? hmmm.
  2. Second approach is to use Custom workflow and work with code. In this approach, the moment user saves the form to SharePoint library, a workflow kicks off which removes the encoded string of attachment and saves it to a SharePoint document library.
  3. This approach (and this is the one that I like) , is to create a custom ItemEventReciever and work with the code to remove those attachments, save those to SharePoint Document Library, Replace the file attachment control with .url file which has a direct link to SharePoint library and finally to update few meta-data inside document based on data collected in InfoPath form. Cool?

I will walk through step by step on the approach # 3 on how to accomplish this task in 3 step process. My next article, I will discuss on the removal of file attachment. In the meanwhile if you can go ahead and set things up for the upcoming series that will be great.

a) Create a new document library (Lets call it FileAttachments)
b) Create 2 custom column(DocumentType, UploadedBy) to the list.

That’s it,  Please wait for my next article where in I will walk through step by step on creating an ItemEventReceiver to accomplish this.

Currently rated 3.0 by 20 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


How to open a browser window from SSRS 2008 report?

clock September 4, 2009 10:54 by author Sandeep Khandelwal

Lots of folks have asked this question and there are gazellions posts out there which gives little insight in this topic. But I thought they all lacked something or the other to get this going. Hence this blog is specifically for someone trying to accomplish something similar.

step 1: Know your URL. Lets say, you wanted to open clients information in your asp.net application by passing in clientID as querystring to that page. so the URL would be /ClientDetails.aspx?clientID">http://<yourdomain>/ClientDetails.aspx?clientID=###

step2: In your reporting services report design view, select the textbox which you want it to act like a hyperlink. Click on text box properties-> Action and in your select URL textbox, click on FX and copy and paste the code below (Remember to change the URL and the actual asp.net page in your implementation.

image 

="javascript:void(window.open('http://<yourdomain>/ClientDetails.aspx?clientID=" & Fields!CliendID.Value & "','Window1','menubar=no,width=430,height=300,toolbar=no'));"

Step 3: Publish the report to reporting services environment. Remember,  using preview mode in Visual Studio will not allow the link to function correctly. In order to test this, you have to publish the report onto the server and access the report that way.

Step4: Test your textbox click event. It should popup a window to your client application.

Step5: A little problem is that the link doesn’t actually look like a hyperlink so user wouldn’t know if a text box is clickable. So, all your do is underline the textbox and change the font-color to blue. Remember to republish. thats it..

Edit: Some folks asked about how to open a file stored in network shared? hmm. Similar approach as outline above, but with a slight change to the code that gets embedded inside Action command of a textbox. And here that is. This should get you going.. Enjoy!!!

="javascript:void(window.open('file://<ServerName>/<Directory>/"&  Fields!LOGIN.Value &".JPG'))"

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Windows Live Writer

clock September 4, 2009 10:40 by author Sandeep Khandelwal

Finally, I was able to make a giant leap forward by upgrading to Live writer. Enough of those tiny mice hacks. Hopefully from this point onwards, my blog will provide little more clarity on what I wanted to share.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


About the author

I work as SharePoint Consultant and Lead ECM Solution Expert for Integration Now (a pioneer in SharePoint solutions in midwest region). Besides having PMP, MCP, MCTS and other technical certifications, I am also an MBA (Finance) from UMKC. I lead & oversee SharePoint engagements in 4 states around Kansas City (MO, KS, IA, & NE).

Tag cloud

Page List

Sign in