microsoftgraph / microsoftgraph/msgraph-sdk-powershell
Get-MgSite properties not returning when -all is used in conjunction with -ExpandProperty.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
Describe the bug
When I run: Get-MgSite -All -ExpandProperty Drive
All some properties are empty when using -All or -Top 10
$Sites[0].Drive
Name Id DriveType CreatedDateTime
But when running Get-MgSite -siteId <example site id> -ExpandProperty Drive it works as expected:
$site.Drive
Name Id DriveType CreatedDateTime
OneDrive b!Pk2E5-ljkk<>DvB business 01/03/2025 02:30:31
Same behavior for other expanded properties like Analytics and CreatedByUser (not tested all)
Expected behavior
Expected same property output from calling by siteId as calling All.
How to reproduce
Execute $Sites = Get-MgSite -All -ExpandProperty Drive
Note none of the Drive attributes are populated.
SDK Version
2.26.1
Latest version known to work for scenario above?
No response
Known Workarounds
Can run a foreach-object loop to run the command individually but it takes a lot longer.
Debug output
Click to expand log
```</details>
### Configuration
Windows 11 x64
Name Value
---- -----
PSVersion 5.1.26100.2161
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.2161
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
### Other information
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing Get-MgSite with -All or -Top 10 and -ExpandProperty Drive, then compare its results with a siteId request and the similar Analytics and CreatedByUser cases. Trace how Get-MgSite handles paging and expanded properties, and verify the generated requests and responses. Done means expanded properties are populated consistently and regression coverage exists for the collection calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100