function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC-vishnuSFDC-vishnu 

Integrate with share point -Attachments

  1. The Files or documents that are attached in Sales Force need to be stored on premise in Sharpoint as well.

I am using vf page :

 

<span style="font-size: small;"><apex:pagestandardController="YourSObjectName" extensions="VFFileUpload">

<apex:form>

<apex:pageBlock title="Upload Attachment">

<apex:inputFile style="width:100%" id="fileToUpload" value="{!fileBody}" filename="{!fileName}" />

            <apex:commandButton value="Upload Attachment" action="{!UploadFile}"/>

</apex:pageBlock>

</apex:form>

</apex:page>

</span>

------------------------------------------------------------------

Apex:

<span style="font-size: small;">public class VFFileUpload

    { 

public Id recId

        {    get;set;    } 

 

publicVFFileUpload(ApexPages.StandardControllerctlr) 

        { 

recId = ctlr.getRecord().Id;      

        } 

 

public string fileName

        {    get;set;    } 

 

public Blob fileBody

        {    get;set;    } 

 

publicPageReferenceUploadFile() 

        { 

PageReferencepr; 

if(fileBody != null &&fileName != null) 

            { 

              Attachment myAttachment  = new Attachment(); 

myAttachment.Body = fileBody; 

myAttachment.Name = fileName; 

myAttachment.ParentId = recId; 

insertmyAttachment; 

pr = new PageReference('/' + myAttachment.Id); 

pr.setRedirect(true); 

returnpr; 

            } 

return null; 

        }     

}</span>

------------------------------------------------------------------------------

My Query is:

 

  1. http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_attachment.htm

 

The attachment body is a base64 type. The file name is any file name like “something.doc”

 

Now my question instead of calling “insert myAttachment” can’t a custom web service be called i and the result will be a URL which could be set with PageReference object or any other API.

 

The webservice will take in parameters like filename, fileData (base64 encoded string) , some metadata and  return a link or URL which can be hooked to the SalesForce page

 

 

 

Please let me know how to achive?and share if u have any code samples