Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 18 13:42
    patrick-rodgers closed #830
  • Jun 18 13:42
    patrick-rodgers opened #830
  • Jul 10 2018 12:58
    patrick-rodgers closed #751
  • Jul 10 2018 12:58
    patrick-rodgers closed #753
  • Jul 10 2018 12:58
    patrick-rodgers closed #758
  • Jul 10 2018 12:57
    patrick-rodgers closed #815
  • Jul 10 2018 12:57
    patrick-rodgers closed #823
  • Jul 10 2018 12:57
    patrick-rodgers closed #824
  • Jul 10 2018 12:57
    patrick-rodgers closed #825
  • Jul 10 2018 12:57
    patrick-rodgers closed #829
  • Jul 10 2018 12:57
    patrick-rodgers commented #829
  • Jul 10 2018 11:06
    Mike-tech opened #829
  • Jul 06 2018 18:26
    koltyakov labeled #828
  • Jul 06 2018 18:21
    ken-harris commented #828
  • Jul 06 2018 18:21
    ken-harris closed #828
  • Jul 06 2018 17:51
    koltyakov labeled #828
  • Jul 06 2018 17:51
    koltyakov commented #828
  • Jul 06 2018 14:23
    ken-harris opened #828
  • Jul 06 2018 13:18
    koltyakov labeled #827
  • Jul 06 2018 13:18
    koltyakov labeled #827
Ryan
@Doogibo_gitlab

Ack sorry, still struggling.

The following works to create the folder just fine:

const list = sp.web.lists.getByTitle('ListA');
const folderName = 'My subfolder';
const rootFolder = 'Folder 1/Folder 2';
list.items.add({
  Title: Util.getGUID(),
  // The folder is created in a root, so create it first with a temp unique name
  FileSystemObjectType: 1,
  ContentTypeId: '0x0120'
  // FileLeafRef unfortunately is ignored while creation
}).then(({ item }) => {
  return item.update({
    Title: folderName, // Rename the folder name
    FileLeafRef: `${rootFolder}/${folderName}` // Move to a subfolder
  });
}).then(console.log);

But I cannot seem to use this method to create list items and store them under these folders.

Ryan
@Doogibo_gitlab
Updating FileLeafRef, the request appears to succeed but when I retrieve the item again, FileLeafRef remains unchanged.
Ryan
@Doogibo_gitlab
addValidateUpdateItemUsingPath results in "Cannot find resource for the request AddValidateUpdateItemUsingPath" - I'm assuming this is another on-premise limitation. ;)
Sergei Sergeev
@s-KaiNet
@Doogibo_gitlab you can try below workaround with moveTo:
list.items.add({
  Title: "test"
}).then(({ item }) => {
  return item.select("FileRef", "ID").get();
}).then(data => {
    console.log(data);
    return sp.web.getFileByServerRelativeUrl(data["FileRef"]).moveTo(`/sites/dev/Lists/FoldersList/MyFolder/Sub/${data["ID"]}_.000`)
})
.then(data => {
    console.log(data);
});
Ryan
@Doogibo_gitlab
Wooohooo! Thank you SO much, Sergei! This worked.
matrixgoh
@matrixgoh

Hi everyone.
I'm trying to make a simple get items query to a large list items with 2 filtering parameter.
The weird thing is that the sequence of the filtering parameter make a difference.
If I not using the right sequence I will get list view threshold exception, and I can reproduce this behaviour in difference SharePoint Online site collection.

Both filtering fields is indexed.
Is anyone have same experience before?

pnp.sp.web.lists.getByTitle("ListName1").items.filter(" col1 eq 'A' and col2 eq 'B' ").getAll().then(console.log);
vs
pnp.sp.web.lists.getByTitle("ListName1").items.filter(" col2 eq 'B' and col1 eq 'A' ").getAll().then(console.log);

Sergei Sergeev
@s-KaiNet
@matrixgoh is it possible to count the number of items returned when only one filter applied? i.e. col1 eq 'A': return x items, col2 eq 'B': return y items
for me it looks like SharePoint applies the first filter and then the second
if the first returns more than treshold value, an error will be thrown
that's just a theory
matrixgoh
@matrixgoh
@s-KaiNet I think you are right, second filter have more items and will throw exception if I only filter with second filter col. How can we overcome this
Andrew Koltyakov
@koltyakov
Sergei is right. For a list with more items than view throttling limitation, the first condition should be based on indexed field and the result after applying the first condition should be less than threshold limit, otherwise the request will be throttled.
matrixgoh
@matrixgoh
@koltyakov yes your explanation is match with my current List index settings. That mean I need to change the field index sequence accordingly, but currently can't change that sequence. I think this is a gray area that MS Docs does not cover in the documentation.
Andrew Koltyakov
@koltyakov
It's not about the order of added indexs in lists settings, but requests structure. If the col2 is indexed and .filter(" col2 eq 'B' and col1 eq 'A' ") fails this is likely because there are more than 5000 items after .filter(" col2 eq 'B'"). And such query structure won't work.
There are also combined indexes with 2 fields which should work in combination.
matrixgoh
@matrixgoh
Like @koltyakov interesting, most of the time I can't create combined index. is any requirement to make a field can be index as secondary column.
Andrew Koltyakov
@koltyakov
Only a certain types can be used together as compound indexes.
Andrew Koltyakov
@koltyakov
Can't find any reliable docs with secondary indexes nuances at the moment.
matrixgoh
@matrixgoh
@koltyakov just notice this, look like basic single line of text is not applicable for combined indexes.
Just wonder is any other method to query a subset of records from SharePoint without hitting the query limitation. Normally we can't project how much the data will grow until exceed the limit.
Andrew Koltyakov
@koltyakov
Not really, only planning and predicting, using time intervals constraints, using search API, ahead of time data preparations, etc.
For some opertions getAll can be handy (without custom sorting and filtering applied it can iterate over a large list using split requests with id offset).
matrixgoh
@matrixgoh
@koltyakov Thanks for you suggestion. I always do planning but sometimes unexpectedly grow still happen.
Ryan
@Doogibo_gitlab

Does anyone have experience with timeout issues in SPA front-ends for SharePoint? Our sites are running on SP 2016 On Premise, and the farm folks assure us that they have timeouts set more so users will be authenticated for the whole day. What we are experiencing, though, is frequent and inconsistently timed timeouts. I implemented a cheap call via pnpjs that runs every 15 seconds, and if there is a 403, I get them to refresh the page, which I'm assuming refreshes their token (which again, shouldn't need refreshing)? It's proving to be quite an annoyance for our users, though.

Just curious if anyone experiences this/has a solution. Thanks so much!

Andrew Koltyakov
@koltyakov
Hi @Doogibo_gitlab, with SP 2016 and ADFS with short ttl sessions we placed a hidden iFrame to a lite SP Page and refresh logic (without main SPA page reload). Also did similar ejecting HTTP client with customized retry logic to refresh an iFrame or retry after a timeout if another request already initiated token refresh. Not sure is this an optimal as it was kind of a hot fix on a project.
Ryan
@Doogibo_gitlab
Wow that's a clever idea! Thanks so much @koltyakov I will give it a shot. :)
Ryan
@Doogibo_gitlab

Is there a way in DevTools to grab the SSO token and check its lifetime? In the long term it would be nice to have be able to bring this forward as proof that the lifetime isn't long enough for SPA apps.

When our farm folks are stating that user's should be authenticated for the whole work day, I know they are speaking about having to go through the login flow again, and not the SSO flow, but I can't seem to get that across.

Ryan
@Doogibo_gitlab
Solution worked great, by the way. Much appreciated!
Ryan
@Doogibo_gitlab

Hey folks,

Is there a way, purely client side, to get the document contents of Word documents and convert them to plain text so that I can search on a query string? Could you also do this on all previous versions of the document?

Thanks so much

Eirik Brandtzæg
@eirikb
@Doogibo_gitlab Can't SharePoint search do that? Eventually the new Microsoft Search
Beside that it's possible to open a word document and search client-side, but it's very resource heavy
Ryan
@Doogibo_gitlab
I think it can definitely search through the current version's contents, but not older version. But that's a good point about it being resource heavy. This sort of thing is maybe better suited to a desktop utility. Thanks @eirikb !
Eirik Brandtzæg
@eirikb
We do similar things, where we open office documents, change the content, and re-build them. They're just zip-files, which can be unzipped and zipped client-side
tarundhillon
@tarundhillon

Hello,

I have a web app hosted on AWS which authenticates via AWS Cognito -- SAML - Azure AD, the authentication process gives me access_token and id_token which I believe are issued by AWS Cognito through Azure AD. I am able to exchange these tokens to get AWS credentials and access AWS resources, but some of my resources are on SharePoint and I was wondering how do I go about authentication to access them ? (pnp/pnpjs#760)

Any suggestions or direction will be much appreciated.

Eirik Brandtzæg
@eirikb
@tarundhillon what does the token look like if you paste it into https://jwt.io/ (debugger)?
I suspect your Azure AD App doesn't have access to SharePoint, have you given it access with Appinv.aspx?
tarundhillon
@tarundhillon
@eirikb Thanks for you suggestions, apologies for the delayed response I wasn't getting alerts for the messages here .. The token seems valid .. i only get id_token
{
"aud": "cdb70e6e-7bf9-4836-a907-xxxxxx",
"iss": "https://sts.windows.net/bf322cf0-59ea-474b-aa22-xxxx/",
"iat": 1563215209,
"nbf": 1563215209,
"exp": 1563219109,
"aio": "ASQA2/8MAAAADFZxxxxxxxxxxxFrPN7A=",
"amr": [
"pwd"
],
"family_name": "xxx",
"given_name": "xxxx",
"ipaddr": "86.25.xxx",
"name": "xxxx xxxx",
"nonce": "b4174032-59b0-488e-a927-xxxxxx",
"oid": "78e4b13d-104f-4009-bbea-xxxxxxx",
"sub": "xL4ne424SdAGDu94FbP5oCyry9ZthpUJcT_xxxxxx",
"tid": "bf322cf0-59ea-474b-aa22-xxxxx",
"unique_name": "xxxx@trexxx-analytics.com",
"upn": "xx.xx@trexx-xx.com",
"uti": "Z-QPxxxx",
"ver": "1.0"
}

and also gives a message RSASHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),

-----BEGIN PUBLIC KEY-----
MIIBIjANBxxxx
-----END PUBLIC KEY-----

,

Private Key. Enter it in plain text only if you want to generate a new token. The key never leaves your browser.

)

I need to check the configuration which you mentioned .. that seems to be the likely cause
thanks for your help.
Dean Verleger
@deanbot
Anyone know if there's a sp pnp powershell gitter?
Eirik Brandtzæg
@eirikb
@tarundhillon No problem. I should have made a comment on GitHub, but I wasn't 100% sure it is correct, but worth a try
matrixgoh
@matrixgoh
Is there a way use pnpjs in Excel ScriptLab app? Anyone try this before?
Tom G
@t0mgerman
Got a quick question about pnp/sp - does it handle renewal of __REQUESTDIGEST for its queries? Built a sort of appraisal app in SPFX / React, responses autosave when the user blurs out of fields etc, each question has a saving and saved state - a couple of users out of many hundreds have said their responses failed to save - although as far as I can tell it shouldn't be possible for that not to be flagged to them (I catch most errors / failed promises etc)... just wanting to know so I can troubleshoot really.. expired tokens have been an issue for me in the past on older versions of SharePoint so just wondering
Andrew Koltyakov
@koltyakov
Hi @t0mgerman,
Yes, PnPjs takes care of digest caching and refresh after it's expired.
You can check digestcache.ts to see how it works.
Tom G
@t0mgerman
@koltyakov - thanks for the quick response! I thought it must be, good to know for sure 👍
freefire8
@freefire8
Hi guyz, is there a way to see on a retreived list if it herits permission or not from site?
Andrew Koltyakov
@koltyakov
image.png
Hi @freefire8, yep, possible, HasUniqueRoleAssignments property contains this info.
matrixgoh
@matrixgoh
Hi, is PnPjs support /_api/site/CreateCopyJobs Web API Method that able to copy document cross site collection?
Andrew Koltyakov
@koltyakov
Hi @matrixgoh , nope, CreateCopyJobs is not implemented. But can be used within PnPjs via SPHttpClient.
matrixgoh
@matrixgoh
Hi, @koltyakov thanks. Any similiar API that can copy a document from one site collection to another site collection.?