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

KeepAttendees (Outlook -> Google Calendar) not setting any DisplayName ((No name) ) in sink #188

Open
frittentheke opened this issue Sep 11, 2024 · 0 comments

Comments

@frittentheke
Copy link
Contributor

When using KeepAttendees (

func (t *KeepAttendees) Transform(source models.Event, sink models.Event) (models.Event, error) {
var sinkAttendees models.Attendees
for _, sourceAttendee := range source.Attendees {
var displayName = sourceAttendee.DisplayName
if t.UseEmailAsDisplayName {
displayName = sourceAttendee.Email
}
var email = sourceAttendee.Email
// Hashing the email and creating the new email to use
emailHashedAndTransformed := fmt.Sprintf("%s@localhost", fmt.Sprint(models.Hash(email)))
if _, err := mail.ParseAddress(emailHashedAndTransformed); err != nil {
return models.Event{}, fmt.Errorf("no valid email address %s: %w", emailHashedAndTransformed, err)
}
sinkAttendees = append(sinkAttendees, models.Attendee{
DisplayName: displayName,
Email: emailHashedAndTransformed,
})
}
sink.Attendees = sinkAttendees
return sink, nil
) the email address is converted into some hash@localhost, but the displayname should then contain either the name or (email)address of the attendee.

Unfortunately for my setup using Outlook as source and Google Calendar as sink this does not seem to work.
All appointments end up having attendees like this:

10489844856491519570@localhost
12212514355089931070@localhost
15921973589580864227@localhost
16338311574219248405@localhost
17242699230287863173@localhost
17352963055167261338@localhost
6873758520474437452@localhost
7320409542426832160@localhost
9405119741488794564@localhost

but with no DisplayName set (Google shows them with (No name). I also tried with the UseEmailAsDisplayName option enabled.

Looking at the source (https://developer.microsoft.com/en-us/graph/graph-explorer?request=me%2Fevents%3F%24select%3Dsubject%2Cbody%2CbodyPreview%2Corganizer%2Cattendees%2Cstart%2Cend%2Clocation&method=GET&version=v1.0&GraphUrl=https://graph.microsoft.com) I can see that the attendees all have am emailAddress containing two fields name and address:

[...]
 "body": {
            "attendees": [
                {
                    "type": "required",
                    "status": {
                        "response": "accepted",
                        "time": "0001-01-01T00:00:00Z"
                    },
                    "emailAddress": {
                        "name": "Rohmann, Christian [It is me - yeah]",
                        "address": "[email protected]"
                    }
                },
[...]

aligning with the model

type Attendee struct {
EmailAdress EmailAddress `json:"emailAddress,omitempty"`
}
type EmailAddress struct {
Name string `json:"name"`
Address string `json:"address"`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants