Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 28 20:00

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jun 28 20:00
    dependabot[bot] closed #108
  • Jun 28 20:00
    dependabot[bot] commented #108
  • Jun 28 20:00
    dependabot[bot] labeled #114
  • Jun 28 20:00
    dependabot[bot] opened #114
  • Jun 28 20:00

    dependabot[bot] on npm_and_yarn

    Bump prismjs from 1.20.0 to 1.2… (compare)

  • Jun 11 11:37
    dependabot[bot] labeled #113
  • Jun 11 11:37
    dependabot[bot] opened #113
  • Jun 11 11:37

    dependabot[bot] on npm_and_yarn

    Bump normalize-url from 4.5.0 t… (compare)

  • Jun 05 03:06
    dependabot[bot] labeled #112
  • Jun 05 03:06
    dependabot[bot] opened #112
  • Jun 05 03:06

    dependabot[bot] on npm_and_yarn

    Bump ws from 6.2.1 to 6.2.2 Bu… (compare)

  • May 11 19:02
    dependabot[bot] labeled #111
  • May 11 19:02
    dependabot[bot] opened #111
  • May 11 19:02

    dependabot[bot] on npm_and_yarn

    Bump hosted-git-info from 2.8.8… (compare)

  • May 11 16:02

    dependabot[bot] on npm_and_yarn

    (compare)

  • May 11 16:02
    dependabot[bot] closed #103
  • May 11 16:02
    dependabot[bot] commented #103
  • May 11 16:02
    dependabot[bot] labeled #110
  • May 11 16:02
    dependabot[bot] opened #110
Rizky
@rizkyramadhan
Nice, but currently it cant upload binary file
I'm still thinking the best way to add it, because it need to use filereader html5 api
Andrew Petersen
@DroopyTersen
yeah i was reading up on that. ideally that addAttachment and uploadFile method would support text or binary
so if typeof fileContent === 'string'
we are good to go, but if its an array buffer we handle that accordingly
the actual work of using the fileReader would probably happen before you ever call SPScript.web.addAttachment()
it would be nice though if to expose a utility method to make getting that binary array buffer simpler
Rizky
@rizkyramadhan
What if i pass base64 string ?
And how do we determine the content-type ?
Andrew Petersen
@DroopyTersen
so assuming addAttachments signatue is addAttachment(itemId, filename, content)
if (typeof content === 'string') //do what we are doing now
else if (typeof content === 'Uint8Array') //handle it however binary upload needs
and you'd get the byte array from the FileReader
the tricky part is figuring out what the HTTP post request looks like for sending binary data
Andrew Petersen
@DroopyTersen
SPScript doesn't depend on jQuery anymore so the ajax is all with raw XMLHttpRequest so I'll need to read up on this: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#section_3
Andrew Petersen
@DroopyTersen
this looks promising to help with binary uploads
Rizky
@rizkyramadhan
Nice
Andrew Petersen
@DroopyTersen
i got the binary stuff working... was very finicky to figure out. i'll push a commit in the next few days that adds web.uploadFile and adds binary support to addAttachment()
Rizky
@rizkyramadhan
Andrew, do you know how to upload picture to image library ?
Andrew Petersen
@DroopyTersen
I do have image upload to Shared Documents working on my local repo. I'll check today to see if it works on an image library as well
Andrew Petersen
@DroopyTersen
Okay I just pushed a new branch with the binary upload stuff working. In src/tests/fileupload.html you'll find a working demo that lets you drag files from windows explorer and upload them to a targeted SharePoint folder. I verified it works you point it at an Image Library
blob
Andrew Petersen
@DroopyTersen
Like you metioned, this relies on FileReader which is not available in IE9. I need to add documentation, yet and also add the binary support to addAttachment, but if your curious the heavy lifting starts in web.protototype._uploadFile(). It allows for passing an optional object of field values you want to set after the file upload succeeds.
Rizky
@rizkyramadhan
Wow, thanks!
Rizky
@rizkyramadhan
This message was deleted
Tăng Thanh tâm
@luckyboykg
Hello, I'm just find this lib in github. How I can authorization spscript with Sharepoint ? I'm working on project using angularjs + Active Directory Authentication Library (ADAL) for JavaScript
Rizky
@rizkyramadhan
Have you try to implement yourself ?
It should be straight forward
In my case, when i open my spscript page, it is asking ad user and password
Andrew Petersen
@DroopyTersen
@luckyboykg is your Angular app being registered with SharePoint as a provider hosted app?
Clint Lechner
@clechner77
@DroopyTersen -- ever give any thought to adding term store/taxonomy helpers? BTW, thanks a TON for SPSCRIPT... it's a god send.
Andrew Petersen
@DroopyTersen
@clechner77 I have def looked into it, but from what I've seen, JSOM is the only option. No REST. Thanks for the kind words!
Clint Lechner
@clechner77
Ah, that's right. Very easy question -- can I return a success/fail result with... say, updateItem? Would be nice to know if it was successful. OK, that was the last question for the day too.... lol.
Andrew Petersen
@DroopyTersen
@clechner77 Yup definitely. All the methods return a promise so you can always do something like updateItem (12,updates).then(onSuccess).catch (onError)
Clint Lechner
@clechner77
When I read your response I dropped my head in shame.... duh. Thanks again!
Clint Lechner
@clechner77
Open up an old project converted all the old code to spscript. Sooooooo much cleaner.
And thank the heavens for your generic rest wrapper
Andrew Petersen
@DroopyTersen
@clechner77 thanks for the kind words! tell your friends :) if we get a few more stars on github I can get cdnjs.com to host it
Clint Lechner
@clechner77
ironically enough, I was looking through my notifications and saw the spscript thread on getItemsByView.... I have an extremely similar script saved on gistbox that was PAAAINFUL to get down
Andrew Petersen
@DroopyTersen
Haha I'll take that as a +1 for "getItemsByView()" in 3.0
BITS
@bitscompagnie
Thank you very much for this library. I am slowly migrating all my existing code to SPScript. I really appreciate the conciseness of the library.
+2 for "getItemsByView()" in 3.0
BITS
@bitscompagnie
How do we access _spPageContextInfo with SPScript?
Andrew Petersen
@DroopyTersen
@bitscompagnie in what way do you mean?
_spPageContextInfo is a global you should be able to get at with window._spPageContextInfo. You could then use the props in there to spin up instances of different spscript objects
BITS
@bitscompagnie
Thanks a lot.
Clint Lechner
@clechner77
@DroopyTersen -- can you change the jsonmimetype/header? I suppose this would have an affect depending on the type of call... but say you wanted to change to minimalmetadata, I see a couple of examples but I'm unclear if they can actually be changed.
Clint Lechner
@clechner77
@DroopyTersen - so I was searching npm today and noticed an spscript beta. wow, nice additions in v3...
Clint Lechner
@clechner77
v3 and IE don't exactly play well, do they? I can't believe how much I hate IE right now....