Error: RequestBodyRead The property 'name' does not exist

Manojcargo 0 Reputation points
2023-09-11T12:49:53.51+00:00

i am going through the "Build Python apps with Microsoft Graph" tutorial and when coding according to the tutorial. When i execute the main.py script getting the below error when i select the option 3 as shown below
python3 main.py

Python Graph Tutorial

To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code IVRGllJPY to authenticate.

Hello, Noreply Manojcargo

Email: noreply@manojcargo.com

Please choose one of the following options:

  1. Exit
  2. Display access token
  3. List my inbox
  4. Send mail
  5. Make a Graph call

3

Error:

RequestBodyRead The property 'name' does not exist on type 'microsoft.graph.recipient'. Make sure to only use property names that are defined by the type or mark the type as open type.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,448 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Charlie Simpson 0 Reputation points
    2023-09-15T01:31:11.4133333+00:00

    You need to edit the EmailAddress() class.

    In graph.py, remove all instances of name and odata type as these are unnecessary in the call resulting in the error.

    Example:

    # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
    additional_data: Dict[str, Any] = field(default_factory=dict)
    # The email address of the person or entity.
    address: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> EmailAddress:
        """
        Creates a new instance of the appropriate class based on discriminator value
        param parse_node: The parse node to use to read the discriminator value and create the object
        Returns: EmailAddress
        """
        if not parse_node:
            raise TypeError("parse_node cannot be null.")
        return EmailAddress()
    
    def get_field_deserializers(self,) -> Dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: Dict[str, Callable[[ParseNode], None]]
        """
        fields: Dict[str, Callable[[Any], None]] = {
            "address": lambda n : setattr(self, 'address', n.get_str_value()),
        }
        return fields
    
    def serialize(self,writer: SerializationWriter) -> None:
        """
        Serializes information the current object
        param writer: Serialization writer to use to serialize this model
        Returns: None
        """
        if not writer:
            raise TypeError("writer cannot be null.")
        writer.write_str_value("address", self.address)
        writer.write_additional_data_value(self.additional_data)
    

    `