<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SharePoint Integration</title><link>https://www.infopathdev.com:443/forums/46.aspx</link><description> For questions concerning issues in the integration of SharePoint and Microsoft InfoPath.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/20294.aspx</link><pubDate>Thu, 31 May 2007 07:49:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20294</guid><dc:creator>darryl2912</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20294.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=20294</wfw:commentRss><description>&lt;p&gt;Hi rdcpro,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Can you help me by using your FormSubmitService to be able to submit the file attachment attached to a IP form and place it into a SharePoint 2007 List?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Please Help&lt;/p&gt;&lt;p&gt;Kind Regards&lt;/p&gt;&lt;p&gt;darryl2912&lt;/p&gt;</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/20293.aspx</link><pubDate>Thu, 31 May 2007 07:36:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20293</guid><dc:creator>darryl2912</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20293.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=20293</wfw:commentRss><description>&lt;p&gt;Hi AndersonR&lt;/p&gt;&lt;p&gt;How do you use this code?&lt;/p&gt;&lt;p&gt;I am in Sharepoint 2007 and I want to extract the InfoPath File Attachment out of a form Library and then place that attachment that I extracted into a Custom List. How would you do this using your code? A web part or a feature. I am not sure?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Please help.&lt;/p&gt;&lt;p&gt;Kind Regards&lt;/p&gt;&lt;p&gt;darryl2912&lt;/p&gt;</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15854.aspx</link><pubDate>Thu, 10 Nov 2005 08:15:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15854</guid><dc:creator>AndersR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15854.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15854</wfw:commentRss><description>At the end if the post i have pasted my version of the code from Matthews and Patricks book (basicly i translated the VB from the book to C# using a reflector). Some conversions were made, for example i use a class not a struct because of null handling.&lt;br /&gt;&lt;br /&gt;You use it like this:&lt;br /&gt;&lt;br /&gt;InfoPathAttachment attachment = new InfoPathAttachment();&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;	//remove binary InfoPath header&lt;br /&gt;	attachment = InfoPathAttachment.DecodeAttachment(document.text);&lt;br /&gt;}&lt;br /&gt;catch (Exception e)&lt;br /&gt;{&lt;br /&gt;	System.Diagnostics.Debug.WriteLine(e);&lt;br /&gt;	throw new Exception("UploadDocument: InfoPath attachment decoding error: " + e);&lt;br /&gt;}&lt;br /&gt;byte[] bytes = attachment.FileData;&lt;br /&gt;string fileName = attachment.FileName.Substring(0, attachment.FileName.Length - 1);//remove terminating zero&lt;br /&gt;&lt;br /&gt;Then its just a matter of calling your imaging or custom web service.&lt;br /&gt;&lt;br /&gt;Remember when you recieve the infopath attachment filename, that it is has a terminating zero, so you need to remove the last char to make your web service call well-formed.&lt;br /&gt;&lt;br /&gt;have fun!&lt;br /&gt;//AndersR&lt;br /&gt;&lt;br /&gt;P.S a shame your first name isnt Carl or something! C Sharp would be the coolest coding name ever :-D&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Runtime.InteropServices;&lt;br /&gt;using System.Security.Permissions;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace Creuna.InfoPath&lt;br /&gt;{&lt;br /&gt;	public class InfoPathAttachment&lt;br /&gt;	{&lt;br /&gt;		// Fields&lt;br /&gt;		public byte[] FileData;&lt;br /&gt;		public string FileName;&lt;br /&gt;&lt;br /&gt;		/// &amp;lt;summary&amp;gt;&lt;br /&gt;		/// .NET representation of the InfoPath File Attachment Header&lt;br /&gt;		/// &amp;lt;/summary&amp;gt;&lt;br /&gt;		[ StructLayout(LayoutKind.Sequential, Pack=1) ]&lt;br /&gt;		private class AttachmentStructure&lt;br /&gt;		{&lt;br /&gt;			public int Signature;&lt;br /&gt;			public int HeaderSize;&lt;br /&gt;			public int InfopathVersion;&lt;br /&gt;			public int Reserved;&lt;br /&gt;			public int Filesize;&lt;br /&gt;			public int FilenameCharLen;&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;		/// &amp;lt;summary&amp;gt;&lt;br /&gt;		/// converts a byte array to an AttachmentStructure&lt;br /&gt;		/// &amp;lt;/summary&amp;gt;&lt;br /&gt;		/// &amp;lt;param name="attachmentArray"&amp;gt;&amp;lt;/param&amp;gt;&lt;br /&gt;		/// &amp;lt;returns&amp;gt;AttachmentStructure&amp;lt;/returns&amp;gt;&lt;br /&gt;		private static AttachmentStructure BytesToHeaderStructure( byte[] attachmentArray )&lt;br /&gt;		{&lt;br /&gt;			int structureLength = Marshal.SizeOf(typeof(InfoPathAttachment.AttachmentStructure));&lt;br /&gt;			&lt;br /&gt;			if (attachmentArray.Length &amp;lt; structureLength)&lt;br /&gt;				return null;&lt;br /&gt;			&lt;br /&gt;			//Allocates memory from the unmanaged memory&lt;br /&gt;			IntPtr pointer = Marshal.AllocHGlobal(structureLength);&lt;br /&gt;&lt;br /&gt;			//Copy data from a one-dimensional, managed 8-bit unsigned integer array to an unmanaged memory pointer&lt;br /&gt;			Marshal.Copy(attachmentArray, 0, pointer, structureLength);&lt;br /&gt;&lt;br /&gt;			//Marshal data from an unmanaged block of memory to a managed object&lt;br /&gt;			AttachmentStructure attachmentStructure = (AttachmentStructure) Marshal.PtrToStructure(pointer, typeof(AttachmentStructure));&lt;br /&gt;			Marshal.FreeHGlobal(pointer);&lt;br /&gt;			return attachmentStructure;&lt;br /&gt;		}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;		public static int Base64EncodedLength(int cb)&lt;br /&gt;		{&lt;br /&gt;			//The base64 encoded header will always be 4/3 the size of the &lt;br /&gt;			//binary version, rounded up to a multiple of 4.			&lt;br /&gt;			return (int) Math.Round((double) (Math.Ceiling(((double) cb) / 3) * 4));&lt;br /&gt;		}&lt;br /&gt; &lt;br /&gt;		/// &amp;lt;summary&amp;gt;&lt;br /&gt;		/// &lt;br /&gt;		/// &amp;lt;/summary&amp;gt;&lt;br /&gt;		/// &amp;lt;param name="InnerTextAttachment"&amp;gt;&amp;lt;/param&amp;gt;&lt;br /&gt;		/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;		public static InfoPathAttachment DecodeAttachment(string InnerTextAttachment)&lt;br /&gt;		{&lt;br /&gt;			AttachmentStructure attachmentStructure = new AttachmentStructure();&lt;br /&gt;			InfoPathAttachment infoPathAttachment = new InfoPathAttachment();&lt;br /&gt;&lt;br /&gt;			//get encoded length of header&lt;br /&gt;			int cbHeaderEncoded = InfoPathAttachment.Base64EncodedLength(Marshal.SizeOf(attachmentStructure.GetType()));&lt;br /&gt;			if ( InnerTextAttachment.Length &amp;lt; cbHeaderEncoded )&lt;br /&gt;			{&lt;br /&gt;				throw new Exception("Encoded string is not long enough to include header.");&lt;br /&gt;			}&lt;br /&gt;&lt;br /&gt;			//decode header from string to byte&lt;br /&gt;			byte[] rgHeader = Convert.FromBase64String(InnerTextAttachment.Substring(0, cbHeaderEncoded));&lt;br /&gt;			&lt;br /&gt;			//decode header from bytes to structure&lt;br /&gt;			attachmentStructure = InfoPathAttachment.BytesToHeaderStructure(rgHeader);&lt;br /&gt;&lt;br /&gt;			//check the signature&lt;br /&gt;			//1095125447 dec is 0x414649c7 hex, or {199, 73, 70, 65}.&lt;br /&gt;			if (!attachmentStructure.Signature.Equals(0x414649c7))&lt;br /&gt;			{&lt;br /&gt;				throw new Exception("Signature does not match InfoPath attachment signature.");&lt;br /&gt;			}&lt;br /&gt;			&lt;br /&gt;			//Check the header size. &lt;br /&gt;			//The size of the header does not include the size of the signature.&lt;br /&gt;			int headerSizeRequired = Marshal.SizeOf(attachmentStructure.GetType()) - 4;&lt;br /&gt;			if (!attachmentStructure.HeaderSize.Equals(headerSizeRequired))&lt;br /&gt;			{&lt;br /&gt;				throw new Exception("Header size does not match expected size.");&lt;br /&gt;			}&lt;br /&gt;&lt;br /&gt;			//Check body&lt;br /&gt;			int cbBodyEncoded = InfoPathAttachment.Base64EncodedLength((attachmentStructure.FilenameCharLen * 2) + attachmentStructure.Filesize);&lt;br /&gt;			if (InnerTextAttachment.Length &amp;lt; (cbHeaderEncoded + cbBodyEncoded))&lt;br /&gt;			{&lt;br /&gt;				throw new Exception("Encoded string is not long enough to include body.");&lt;br /&gt;			}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;			byte[] rgBody = Convert.FromBase64String(InnerTextAttachment.Substring(cbHeaderEncoded, cbBodyEncoded));&lt;br /&gt;&lt;br /&gt;			//copy out filename&lt;br /&gt;			infoPathAttachment.FileName = Encoding.Unicode.GetString(rgBody, 0, attachmentStructure.FilenameCharLen * 2);&lt;br /&gt;&lt;br /&gt;			//copy out the rest of the file bytes&lt;br /&gt;			infoPathAttachment.FileData = (byte[]) Array.CreateInstance(typeof(byte), attachmentStructure.Filesize);&lt;br /&gt;			Array.Copy(rgBody, (int) (attachmentStructure.FilenameCharLen * 2), infoPathAttachment.FileData, 0, attachmentStructure.Filesize);&lt;br /&gt;&lt;br /&gt;			return infoPathAttachment;&lt;br /&gt;		}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15853.aspx</link><pubDate>Thu, 10 Nov 2005 00:33:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15853</guid><dc:creator>rdcpro</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15853.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15853</wfw:commentRss><description>Thanks Anders, &lt;br /&gt;&lt;br /&gt;Even though Matthew is creating the InfoPath header (and I want to extract it), that example will save me quite a bit of time.  I figured out the header structure from the documentation, but there were a few parts that weren't completely clear (e.g., it mentioned I needed a non-ASCII character, but didn't say it should be a null!).  And I hadn't noticed that the filename length was in characters, not bytes...I probably would have wasted some time before I figured that out! ;^)&lt;br /&gt;&lt;br /&gt;I can't help thinking that what would really be useful here is a new InfoPath IFilter...I've had great success with a custom HTML IFilter I use to index our content management system.  In that case, I wouldn't have to mess with the attachment in the InfoPath form at all, and I could deal with any IP form posted to SharePoint, not just those that are processed with my web service.  But, it's probably less work to modify my web service to strip the attachment anyway.&lt;br /&gt;&lt;br /&gt;Thanks again,&lt;br /&gt;Mike Sharp</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15852.aspx</link><pubDate>Wed, 09 Nov 2005 22:05:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15852</guid><dc:creator>AndersR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15852.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15852</wfw:commentRss><description>Let me know if you run into trouble extracting the attachments and adding them to SPS.&lt;br /&gt;&lt;br /&gt;I already did this, and you need to tweak both IP and SPS a bit to make it happen:&lt;br /&gt;&lt;br /&gt;-no web service makes you add images with meta data, so if meta data is an issue you need either to create a custom SPS web service or use FP-Remote Procedure Calls. If no meta data is needed, the Upload method of Imaging.asmx is your friend. Creating a custom web service for sharepoint is straight forward though&lt;a target="_blank" href=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/ODC_WritingCustomWebServicesforSPPT.asp&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/ODC_WritingCustomWebServicesforSPPT.asp&lt;/a&gt;&lt;br /&gt;-extracting the headers takes some effort. Matthew Blain (co-writer of Mr Halstead's book "Developing solutions with MS InfoPath") created some code that does this. The pages with his InfoPath tips are down at the moment, but you can grab them using the WayBackMachine:&lt;a target="_blank" href=http://web.archive.org/web/20041009132349/http://tips.serriform.com/CSharpCreateInfoPathAttachment.htm&gt;http://web.archive.org/web/20041009132349/http://tips.serriform.com/CSharpCreateInfoPathAttachment.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;hth&lt;br /&gt;//AndersR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15851.aspx</link><pubDate>Wed, 09 Nov 2005 18:11:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15851</guid><dc:creator>rdcpro</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15851.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15851</wfw:commentRss><description>Oh, I'd say if you're willing to write code to work with SharePoint's query service, its &lt;b&gt;quite&lt;/b&gt; configurable, especially if you write an IFilter for any special stuff (such as custom metadata).  &lt;br /&gt;&lt;br /&gt;But yes, attachments are the issue for me.  I can search the InfoPath form just fine.&lt;br /&gt;&lt;br /&gt;I guess I'll modify my FormSubmitService to extract the attachment, and PUT it to a separate SharePoint document library.  &lt;br /&gt;&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Mike Sharp</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15850.aspx</link><pubDate>Wed, 09 Nov 2005 08:34:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15850</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15850.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15850</wfw:commentRss><description>SPS can do this. You have to do some special stuff to make it happen but it is doable. We have a solution that uses search. However, we also chose to provide an InfoPath form that searches the form library since we had more control over it. SPS search wasn't configurable enough for our solution requirements.&lt;br /&gt;&lt;br /&gt;Attachments is a bigger issue. Don't know if this is going to be handled or not in the next version.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15849.aspx</link><pubDate>Tue, 08 Nov 2005 22:34:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15849</guid><dc:creator>rdcpro</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15849.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15849</wfw:commentRss><description>Yes, that's what I was referring to.  It seems pretty limiting to have InfoPath forms with attachments that can't be indexed.  &lt;br /&gt;&lt;br /&gt;I know that I can do it programmatically, and of course I'll have to read the header structure as well to get the filename, among other things.  But I was hoping there was something simpler I was overlooking.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Mike Sharp</description></item><item><title>Re: SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15848.aspx</link><pubDate>Tue, 08 Nov 2005 22:25:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15848</guid><dc:creator>AndersR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15848.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15848</wfw:commentRss><description>Do you mean an IP file attachment in an IP xml file?&lt;br /&gt;&lt;br /&gt;Those are stored in base64 encoding, so i see no obvious way to index them, especially because IP add a special header to them (containing filename, icon etc) that you need to remove programmaticly to access the file outside IP.&lt;br /&gt;&lt;br /&gt;//AndersR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>SPS Searching of InfoPath file attachments</title><link>https://www.infopathdev.com:443/forums/thread/15313.aspx</link><pubDate>Tue, 08 Nov 2005 21:50:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15313</guid><dc:creator>rdcpro</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15313.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=15313</wfw:commentRss><description>It doesn't seem like SharePoint can crawl/search the content of an InfoPath file attachment, at least not out of the box.  This seems strange to me, since that would be a fairly common scenario for InfoPath/SharePoint integration with attachments.  So, maybe I'm overlooking something.  &lt;br /&gt;&lt;br /&gt;Does anyone know of a way to get SharePoint to crawl a file attachment in an InfoPath form that doesn't involve programmatically extracting the encoded binary from the form and saving it separately to a doc lib?  Hopefully there is an "out of the box" solution I'm overlooking, or else a widget that we could buy for this.   &lt;br /&gt;&lt;br /&gt;Otherwise I'll write the code to do it, and plug it into an existing web service...&lt;br /&gt;&lt;br /&gt;Thanks in advance,&lt;br /&gt;Mike</description></item></channel></rss>