Skip to main content
Hi,

Can anyone provide me with some pointers or a walkthrough for using the K2DocAttachment control?

I'm trying to build a small document approval workflow and would like to use this control on the Approval SmartForm to provide the approver with a link to the document...

I've been struggling with the following properties:

AttachedDocuments
AttachedDocumentsXPath
DocumentLibrary
DocumentLibraryXPath
SharePointServer
SharePointServerXPath

I've tried looking through the Help files, but there doesn't seem to any examples for this control...

Thanks in advance.
icon-quote.gifdavid.hutson:
Hi,

Can anyone provide me with some pointers or a walkthrough for using the K2DocAttachment control?



Yes, please. A walkthrough would be nice.
Hi

Ok ill give a quick run down of those properties:

AttachedDocuments:
This should be set to the k2 xml data field in which you want to store the attached document details. The format for the XML for the attachments must be like the following:


<spsdocuments>
<documents>
<document>
<server/>
<site/>
<workspace/>
<folder/>
<docname/>
<filefullurl/>
</document>
</documents>
</spsdocuments>


AttachedDocumentsXPath:
This is the XPath of the xml element where the attached document details will be stored. So if we look at the following xml data&colon;


<?xml version='1.0' encoding='UTF-8'?>
<root>
<spsdocuments>
<documents>
<document>
<server/>
<site/>
<workspace/>
<folder/>
<docname/>
<filefullurl/>
</document>
</documents>
</spsdocuments>
<root/>


The XPath must be set to "/spsdocuments/documents"

DocumentLibrary:
This property is used when you want to specify a Document library where you want to upload your documents in SharePoint. If you leave it blank the attachment control will allow you to browse to any Library that you have rights to. You can either store this value in a K2 data field or xml data field, or you can chose the document library at design time. If you want to select it at design time you must set the DocumentLibraryServer property to your development SPS server (take note the DocumentLibraryServer property is only used at design time) and the developement SPS server library structure must be the same as what it will be at run time. Once you set the DocumentLibraryServer
propery you can browse to the desired document library by clicking on the elipses button of the DocumentLibrary property.

DocumentLibraryXPath:
This property is used when you want to specify a Document library where you want to upload your documents in SharePoint. It is however used
when you want to store the DocumentLibrary value in a K2 XML data field. It is basically the XPath to where the DocumentLibrary value is stored in the xml data field.

SharePointServer:
This property is used at run time. This should be set to SharePoint server that you want to use to store your documents on. You can hardcode it or set is to a K2.net Data filed or XML data field. It should look more or less like this: http://MySPSServer:85

SharePointServerXPath:
If you chose to store the SharePointServer value in a XML data field set this property to the a XPath where the data is stored.

Hmm, ok hope this sheds some light on the control.

Cheers
Hi,
I am trying to use k2attachment control in smartforms. At the time of attching document , the "Add" button is disabled. Can you please help me how to use the K2Attcahement control? What is the reason the "Add" button is disabled?

Thanks
Make sure that the "AllowAdd" property of the document attachment control is set to "True".
I have already set the "AllowAdd" property to "True". Still I am not able to attach the document. Add button is disabled.
At the time of attching document , the "Add" button is disabled

A workaround is to give the user "Web Designer" permissions on the SPS site, then the add utton should be enabled. I'm not yet sure why this is happening, though.

Hi neil, I had already implemented that workaround to get the button enabled. But my client does not want to use that work around as it increases end-users permissions on Sharepoint Site. Can you suggest any other work around.
When using K2 Doc Attachment, Add button is disable.
I have followed all the intructions on this topic, including:
-Setting K2 Doc Attachment control properties
-Grant rights to contributor on sharepoint

But the Add button is still disable.
Any one can help me?.
Have you tried making the user a 'Web designer' in Sharepoint?

Regards,
Ockert

Reply