Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extended createFile to allow passing of field to be populated on upload #29

Closed
wants to merge 2 commits into from

Conversation

caleuanhopkins
Copy link
Contributor

Expanded the createFile function to allow the ability to populate fields on file upload. Example of new functionality:

$SP().createFile({
    content:"*your stuff with FileToDataURI that returns a base64 string*",
    encoded:true,
    destination:"http://mysite/Shared Documents/myfile.xls",
    extraFields: [{Title:{value:"Hello world",type:"Text"}}],
    url:"http://mysite/"
});

Title is the name of the column you want to populate
value is the data to populate the field
type child can be one of the following options:

  • Invalid
  • Integer
  • Text
  • Note
  • DateTime
  • Counter
  • Choice
  • Lookup
  • Boolean
  • Number
  • Currency
  • URL
  • Computed
  • Threading
  • Guid
  • MultiChoice
  • GridChoice
  • Calculated
  • File
  • Attachments
  • User
  • Recurrence
  • CrossProjectLink
  • ModStat
  • AllDayEvent
  • Error

You can fill multiple columns by something like:

$SP().createFile({
    content:"*your stuff with FileToDataURI that returns a base64 string*",
    encoded:true,
    destination:"http://mysite/Shared Documents/myfile.xls",
    extraFields: [{Title:{value:"Hello world",type:"Text"}},{Title2:{value:"Hello world Again",type:"Text"}}],
    url:"http://mysite/"
});

@Aymkdn
Copy link
Owner

Aymkdn commented Apr 19, 2016

Thanks for the PR, however I cannot accept it because it's not IE8 compliant (you use Object.keys). Also I'll need to run tests (because I never faced this case).

@caleuanhopkins
Copy link
Contributor Author

@Aymkdn ha ha whoops, we use enterprise mode for our Sharepoint and I forgot to test the code in that mode! Will update, fix and test tomorrow. Also I have a patch for CORS in IE 8 I can push up to if you like?

@Aymkdn
Copy link
Owner

Aymkdn commented Apr 20, 2016

@caleuanhopkins feel free to push/post what you want and I'll see if I accept it... at least it can gives me new ideas :-)

…8 in enterprise mode. allows development on localhost to connect to SOAP Sharepoint server
@caleuanhopkins
Copy link
Contributor Author

@Aymkdn I've added a polyfill for object.keys and added the cors enabling

@Aymkdn
Copy link
Owner

Aymkdn commented Apr 22, 2016

I don't know which version of jQuery you use, but $.support.cors doesn't seem required anymore in the last version of jQuery (and crossDomain would be used in a very specific case).

I'm working on SharepointPlus v3.13 that won't be depend on jQuery anymore, even if it will be possible to keep using it :-)

@Aymkdn
Copy link
Owner

Aymkdn commented Aug 23, 2016

Sharepoint v3.13 released today: https://github.com/Aymkdn/SharepointPlus/releases/tag/v3.13

@Aymkdn Aymkdn closed this Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants