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

Release 4.5.0 #3130

Merged
merged 13 commits into from
Sep 16, 2024
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 4.5.0 - 2024-Sept-16

- Only documentation and package updates

## 4.4.0 - 2024-Aug-12

- sp
Expand All @@ -14,7 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- graph
- 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.


## 4.3.0 - 2024-July-15

- sp
Expand Down
2 changes: 1 addition & 1 deletion debug/spfx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@pnp/logging": "^4.0.1",
"@pnp/sp": "^4.0.1",
"@pnp/sp-admin": "^4.0.1",
"tslib": "2.3.1"
"tslib": "2.7.0"
},
"devDependencies": {
"@microsoft/eslint-config-spfx": "1.18.2",
Expand Down
15 changes: 8 additions & 7 deletions docs/graph/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ import * as fs from "fs";
import { graphfi } from "@pnp/graph";
import "@pnp/graph/files";
import "@pnp/graph/users";
import {IFileUploadOptions} from "@pnp/graph/files";

import { DriveItem as DriveItemType } from "@microsoft/microsoft-graph-types";
const graph = graphfi(...);

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

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

// Upload a chunk of the file to the upload session
// Using a fragment size that doesn't divide evenly by 320 KiB results in errors committing some files.
const chunkSize = 327680;
const chunkFactor = 1;
const chunkSize = 327680 * chunkFactor;
let startFrom = 0;
let driveItem: DriveItemType = null;
while (startFrom < fileBuff.length) {
const fileChunk = fileBuff.slice(startFrom, startFrom + chunkSize);
const contentLength = `bytes ${startFrom}-${startFrom + chunkSize}/${fileBuff.length}`
const uploadChunk = await uploadSession.resumableUpload.upload(chunkSize, fileChunk, contentLength);
const fileChunk = Uint8Array.prototype.slice.call(fileBuff, startFrom, startFrom + chunkSize);
const range = `bytes ${startFrom}-${(startFrom + fileChunk.length) - 1}/${fileBuff.length}`;
driveItem = await uploadSession.resumableUpload.upload(fileChunk.length, fileChunk, range);
startFrom += chunkSize;
}
```
Expand Down
7 changes: 6 additions & 1 deletion docs/graph/sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ import "@pnp/graph/sites";
const graph = graphfi(...);
const sharepointHostName = "contoso.sharepoint.com";
const serverRelativeUrl = "/sites/teamsite1";
const siteInfo = await graph.sites.getByUrl(sharepointHostName, serverRelativeUrl)();
// Will be converted to a ISite object that can then be called, must be awaited.
const site: ISite = await graph.sites.getByUrl(sharepointHostName, serverRelativeUrl);
// Now use the ISite object to get drives
const drives = await site.drives();
// Now use the ISite object to get the site information
const siteInfo = await site();
```

### getAllSites
Expand Down
11 changes: 4 additions & 7 deletions docs/sp/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,15 @@ Both the addChunked and setContentChunked methods support options beyond just su

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:

`(data: ChunkedFileUploadProgressData) => void`
`(data: IFileUploadProgressData) => void`

The data interface is:

```typescript
export interface ChunkedFileUploadProgressData {
export interface IFileUploadProgressData {
uploadId: string;
stage: "starting" | "continue" | "finishing";
blockNumber: number;
totalBlocks: number;
chunkSize: number;
currentPointer: number;
fileSize: number;
offset: number;
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sp/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ console.log(r.Title);
});
```

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.
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.

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