Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Encoding a file - Filename

$
0
0

What is the filename structure for xnFileName in the code string fileName = xnFileName.Value;?

I am pointing to a SharePoint list. Is the xnFileName value

http://sitesname.server.com/documents/myfile.doc

or this

myfile.doc

???

Thanks,

//Create an XmlNamespaceManager
 	XmlNamespaceManager ns = this.NamespaceManager;

 	//Create an XPathNavigator object for the Main data source
 	XPathNavigator xnMain = this.MainDataSource.CreateNavigator();

 	//Create an XPathNavigator object for the attachment node
 	XPathNavigator xnAttNode = xnMain.SelectSingleNode("/my:myFields/my:theAttachmentField", ns);

 	//Create an XPathNavigator object for the filename node
 	XPathNavigator xnFileName = xnMain.SelectSingleNode("/my:myFields/my:theAttachmentName", ns);

 	//Obtain the text of the filename node.
 	string fileName = xnFileName.Value;
 	if (fileName.Length > 0)
 	{
 	 	//Encode the file and assign it to the attachment node.
 	 	InfoPathAttachmentEncoder myEncoder = new InfoPathAttachmentEncoder(fileName);

 	 	//Check for the "xsi:nil" attribute on the file attachment node and remove it
 	 	//before setting the value to attach the filerRemove the "nil" attribute
 	 	if (xnAttNode.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))
 	 	 	xnAttNode.DeleteSelf();

 	 	//Attach the file
 	 	xnAttNode.SetValue(myEncoder.ToBase64String());
 	}              



Chris


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>