You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: CreateLinkPostRequestBody serializes retainInheritedPermissions=false by default starting in 1.59.2 #1563
I was using the CreateLinkPostRequestBody to create some link to my driveItems, and it was working properly, but at some point I noticed that some of these files would not be visible to some users anymore (inherited permissions were lost).
The "bug"
Starting with msgraph-sdk-python 1.59.2, CreateLinkPostRequestBody serializes: { "retainInheritedPermissions": false, "sendNotification": false } when these properties are not explicitly set by the caller.
This changes the behavior of the createLink API. According to the Microsoft Graph documentation, retainInheritedPermissions is optional and the service default when omitted is true .
Expected behavior
I believe that the CreateLinkPostRequestBody default attribute values should follow the defaults of the createLink API.
Thus setting retainInheritedPermissions to true(or unset) for the createLink API if not provided in CreateLinkPostRequestBody.
How to reproduce
test.py
from msgraph.generated.drives.item.items.item.create_link.create_link_post_request_body import CreateLinkPostRequestBody
request_body = CreateLinkPostRequestBody(
type="view",
scope="organization"
)
from kiota_serialization_json.json_serialization_writer import JsonSerializationWriter
writer = JsonSerializationWriter()
request_body.serialize(writer)
print(writer.get_serialized_content().decode('utf-8'))
Results
version 1.58.0
{
"scope": "organization",
"type": "view"
}
This will let the createLink API default the retainInheritedPermissions to True.
I traced where this comes from. It is not specific to 1.59.2. The July regeneration (5e7e5d3, "update request builders and models") started emitting OpenAPI default: false values as dataclass defaults, and the v1.0 description in msgraph-metadata declares retainInheritedPermissions and sendNotification with default: false. So the generated field is now retain_inherited_permissions: Optional[bool] = False (create_link_post_request_body.py#L20-L22) and the serializer always writes it. Earlier builds defaulted to None, so the property was left out.
On 1.64.0, CreateLinkPostRequestBody(type="view", scope="organization") serializes to:
The same default appears in the other create_link request bodies (list items under drives, groups, sites and shares) and in invite_post_request_body. Since these files are generated, the lasting fix probably belongs in the metadata or the generator settings rather than this repo.
Activity
basitalisandhu commentedon Oct 16, 2026
I traced where this comes from. It is not specific to 1.59.2. The July regeneration (5e7e5d3, "update request builders and models") started emitting OpenAPI
default: falsevalues as dataclass defaults, and the v1.0 description in msgraph-metadata declaresretainInheritedPermissionsandsendNotificationwithdefault: false. So the generated field is nowretain_inherited_permissions: Optional[bool] = False(create_link_post_request_body.py#L20-L22) and the serializer always writes it. Earlier builds defaulted toNone, so the property was left out.On 1.64.0,
CreateLinkPostRequestBody(type="view", scope="organization")serializes to:{"retainInheritedPermissions": false, "scope": "organization", "sendNotification": false, "type": "view"}Workaround until it is fixed: pass
Noneexplicitly, which serializes to{"scope": "organization", "type": "view"}:The same default appears in the other
create_linkrequest bodies (list items under drives, groups, sites and shares) and ininvite_post_request_body. Since these files are generated, the lasting fix probably belongs in the metadata or the generator settings rather than this repo.