Skip to content

Commit 8b629ca

Browse files
authored
Merge pull request #3130 from pnp/version-4
Release 4.5.0
2 parents 724218e + 51d905a commit 8b629ca

File tree

20 files changed

+235
-649
lines changed

20 files changed

+235
-649
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## 4.5.0 - 2024-Sept-16
9+
10+
- Only documentation and package updates
11+
812
## 4.4.0 - 2024-Aug-12
913

1014
- sp
@@ -14,7 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1418
- graph
1519
- Addresses #3083 - Adds the ability to pass in retrieveProperties to getAllChildrenAsTree. V2 and V3 had this functionality. Only supports Shared Custom Properties, not Local Custom Properties.
1620

17-
1821
## 4.3.0 - 2024-July-15
1922

2023
- sp

debug/spfx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@pnp/logging": "^4.0.1",
2424
"@pnp/sp": "^4.0.1",
2525
"@pnp/sp-admin": "^4.0.1",
26-
"tslib": "2.3.1"
26+
"tslib": "2.7.0"
2727
},
2828
"devDependencies": {
2929
"@microsoft/eslint-config-spfx": "1.18.2",

docs/graph/files.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ import * as fs from "fs";
305305
import { graphfi } from "@pnp/graph";
306306
import "@pnp/graph/files";
307307
import "@pnp/graph/users";
308-
import {IFileUploadOptions} from "@pnp/graph/files";
309-
308+
import { DriveItem as DriveItemType } from "@microsoft/microsoft-graph-types";
310309
const graph = graphfi(...);
311310

312311
const fileBuff = fs.readFileSync("C:\\MyDocs\\TestDocument.docx");
@@ -317,7 +316,7 @@ const fileUploadOptions: IResumableUploadOptions<DriveItemUploadableProperties>
317316
},
318317
};
319318

320-
// Create the upload session
319+
// Create the upload session, must get the drive root folder id to call createUploadSession
321320
const uploadSession = await graph.users.getById(userId).drive.getItemById(driveRoot.id).createUploadSession(fileUploadOptions);
322321
// Get the status of the upload session
323322
const status = await uploadSession.resumableUpload.status();
@@ -327,12 +326,14 @@ const upload = await uploadSession.resumableUpload.upload(fileBuff.length, fileB
327326

328327
// Upload a chunk of the file to the upload session
329328
// Using a fragment size that doesn't divide evenly by 320 KiB results in errors committing some files.
330-
const chunkSize = 327680;
329+
const chunkFactor = 1;
330+
const chunkSize = 327680 * chunkFactor;
331331
let startFrom = 0;
332+
let driveItem: DriveItemType = null;
332333
while (startFrom < fileBuff.length) {
333-
const fileChunk = fileBuff.slice(startFrom, startFrom + chunkSize);
334-
const contentLength = `bytes ${startFrom}-${startFrom + chunkSize}/${fileBuff.length}`
335-
const uploadChunk = await uploadSession.resumableUpload.upload(chunkSize, fileChunk, contentLength);
334+
const fileChunk = Uint8Array.prototype.slice.call(fileBuff, startFrom, startFrom + chunkSize);
335+
const range = `bytes ${startFrom}-${(startFrom + fileChunk.length) - 1}/${fileBuff.length}`;
336+
driveItem = await uploadSession.resumableUpload.upload(fileChunk.length, fileChunk, range);
336337
startFrom += chunkSize;
337338
}
338339
```

docs/graph/sites.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ import "@pnp/graph/sites";
4343
const graph = graphfi(...);
4444
const sharepointHostName = "contoso.sharepoint.com";
4545
const serverRelativeUrl = "/sites/teamsite1";
46-
const siteInfo = await graph.sites.getByUrl(sharepointHostName, serverRelativeUrl)();
46+
// Will be converted to a ISite object that can then be called, must be awaited.
47+
const site: ISite = await graph.sites.getByUrl(sharepointHostName, serverRelativeUrl);
48+
// Now use the ISite object to get drives
49+
const drives = await site.drives();
50+
// Now use the ISite object to get the site information
51+
const siteInfo = await site();
4752
```
4853

4954
### getAllSites

docs/sp/files.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,15 @@ Both the addChunked and setContentChunked methods support options beyond just su
333333

334334
A method that is called each time a chunk is uploaded and provides enough information to report progress or update a progress bar easily. The method has the signature:
335335

336-
`(data: ChunkedFileUploadProgressData) => void`
336+
`(data: IFileUploadProgressData) => void`
337337

338338
The data interface is:
339339

340340
```typescript
341-
export interface ChunkedFileUploadProgressData {
341+
export interface IFileUploadProgressData {
342+
uploadId: string;
342343
stage: "starting" | "continue" | "finishing";
343-
blockNumber: number;
344-
totalBlocks: number;
345-
chunkSize: number;
346-
currentPointer: number;
347-
fileSize: number;
344+
offset: number;
348345
}
349346
```
350347

docs/sp/lists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ console.log(r.Title);
7070
});
7171
```
7272

73-
You can also provide other (optional) parameters like description, template and enableContentTypes. If that is not enough for you, you can use the parameter named 'additionalSettings' which is just a TypedHash, meaning you can sent whatever properties you'd like in the body (provided that the property is supported by the SharePoint API). You can find a [listing of list template codes](https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.splisttemplatetype?view=sharepoint-server) in the official docs.
73+
You can also provide other (optional) parameters like description, template and enableContentTypes. If that is not enough for you, you can use the parameter named 'additionalSettings' which is just a TypedHash, meaning you can sent whatever properties you'd like in the body (provided that the property is supported by the SharePoint API). You can find a [listing of list template codes](https://learn.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wssts/8bf797af-288c-4a1d-a14b-cf5394e636cf) in the official docs.
7474

7575
```TypeScript
7676
// this will create a list with template 101 (Document library), content types enabled and show it on the quick launch (using additionalSettings)

0 commit comments

Comments
 (0)