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
ECMA(JSOM) script cannot be used to upload file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.