0

I try upload document to sharepoint document library using JCOM, but I have problem with metadata: brower console say "TypeError: SP.FileCreationInformation is not a constructor" and give link on "this.fi = new SP.FileCreationInformation();"

    <SharePoint:ScriptLink ID="ScriptLink1" runat="server" Name="SP.js" Localizable="false" OnDemand="False" LoadAfterUI="True"></SharePoint:ScriptLink>
<SharePoint:ScriptLink ID="ScriptLink2" runat="server" Name="SP.Core.js" Localizable="false" OnDemand="False" LoadAfterUI="True"></SharePoint:ScriptLink>
<SharePoint:ScriptLink ID="ScriptLink3" runat="server" Name="SP.Runtime.js" Localizable="false" OnDemand="False" LoadAfterUI="True"></SharePoint:ScriptLink>
<SharePoint:ScriptLink ID="ScriptLink4" runat="server" Name="SP.Debug.js" Localizable="false" OnDemand="False" LoadAfterUI="True"></SharePoint:ScriptLink>

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(
        function () {
            ExecuteOrDelayUntilScriptLoaded(DDLBindData, "sp.js");
        }
    );

    var array = [];
    var counter = 1;

    function DDLBindData() {
        var clientContext = new SP.ClientContext.get_current();
        var web = clientContext.get_web();

        clientContext.load(web);
        clientContext.executeQueryAsync(Function.createDelegate(this, this.OnQuerySucceeded), Function.createDelegate(this, this.OnQueryFailed));

        this.listCollection = web.get_lists();
        this.list = this.listCollection.getByTitle("TestLib");
        this.contentTypeCollection = this.list.get_contentTypes();

        this.fi = new SP.FileCreationInformation();

        clientContext.load(this.contentTypeCollection);
        clientContext.executeQueryAsync(Function.createDelegate(this, this.OnQuerySucceeded), Function.createDelegate(this, this.OnQueryFailed));
    }

but intellisence show me other metod like FileCreationInformation

KewinAstro
  • 1
  • 1
  • 2

1 Answers1

0

ECMA(JSOM) script cannot be used to upload file.

refer http://social.technet.microsoft.com/Forums/sharepoint/en-US/34cc5d22-f47b-4ac4-9057-bbcc9f9baadd/ecma-script-for-uploading-image-to-sharepoint-2010-document-library?forum=sharepointdevelopmentprevious

Kunal Valecha
  • 207
  • 1
  • 8
  • I know that JSOM _can_ upload files in tandem. I do that with ListItem's, but I can't do same thing with document file element – KewinAstro Dec 17 '13 at 11:41