I am trying to create Google Contact using Google Contacts API.
According to Google doc(as below), I have already implement the create function.
Google Docs Creating contacts
To create a new contact, send an authorized POST request to the user's contacts feed URL with contact data in the body.
The URL is of the form:
https://www.google.com/m8/feeds/contacts/{userEmail}/full
I use this query to create a contact:
www.google.com/m8/feeds/contacts/{userEmail}/full
However, the new contact is created in the group "Other Contact" by default.
How can I directly create in the group "My Contact"?
Do I need to modify the query?
From the doc (https://developers.google.com/google-apps/contacts/v3/?csw=1#authorizing_requests_to_the_api_name_service):
Contact Group Entry
Contacts can be placed into user-defined groups. You can create,
retrieve, update, and delete these groups using the Contacts Data API,
and you can add contacts to a group or remove contacts from a group.
For details, see the following sections.
The Contacts Data API also provides access to four predefined "system
groups" for each user:
My Contacts Friends Family Coworkers System groups appear in a groups
feed just like user-defined groups do. In fact, system groups are
mostly treated just like other groups. The differences are:
Each system group entry contains a subelement.
The id attribute of that subelement indicates which system group the
group is: Contacts, Friends, Family, or Coworkers. Note that the My
Contacts ID value is simply Contacts, without the "My". Also note
that this system group ID value is different from the group ID given
in the group entry's element. You can't add new system groups,
change the name of a system group, add extended properties to a system
group, or delete a system group. * The contact-group entry
representing a system group doesn't contain a rel="edit" link.
def get_group_id(label_name):
feed = gd_client.GetGroups()
for entry in feed.entry:
if entry.title.text.lower() == label_name:
return entry.id.text
contact_entry = gdata.contacts.data.ContactEntry() #contact_entry
group = get_group_id("My Contact") #group id
membership = gdata.contacts.data.GroupMembershipInfo(href=group) #group membership
contact_entry.group_membership_info.append(membership) # adding group membership to contact_entry
Its not true that contacts can only be placed into user-defined groups. I just experimented with Google Contact V3 API and was able to put a contact under system defined group (My contacts):
ContactEntry contact = new ContactEntry();
Name name = new Name();
final String NO_YOMI = null;
name.setFullName(new FullName("Elizabeth Bennet", NO_YOMI));
name.setGivenName(new GivenName("Elizabeth", NO_YOMI));
name.setFamilyName(new FamilyName("Bennet", NO_YOMI));
contact.setName(name);
GroupMembershipInfo groupInfo = new GroupMembershipInfo();
//You can fetch the following link from GroupEntry#getId()
groupInfo.setHref("http://www.google.com/m8/feeds/groups/{EmailId}/base/{groupId}");
groupInfo.setDeleted(false);
contact.getGroupMembershipInfos().add(groupInfo);
ContactEntry createdContact = myService.insert(new URL(
"https://www.google.com/m8/feeds/contacts/{EmailId}/full"), contact);
Related
I'm creating a Google Data Studio dashboard with the filter by email option. It's easy to do it when you want to allow the user to see only one option, for example
user region
alice A
bob F
charlie Z
But how can I do to give access to some user to all regions from A to Z? Is there a better way to do it than simply creating 26 rows for every user with this admin access?
I'd like to avoid creating this table:
user region
admin A
admin B
admin C
...
admin Z
and instead do something similar to this
user region
admin *
In bigquery connector, you can write custom query like -
select *
FROM table_name
where
case when #DS_USER_EMAIL IN (select distinct map_field from table_name )
then #DS_USER_EMAIL
else 'all' end = map_field
You will have to create a mapping for 'all' one time. But this works. No need to use feature - filter by email id
I have a meetings table where I am storing meeting information and where I can select a meeting between 2 types of user visitor type user and host type user. I have a many to many relationships between users and meeting that's why I have a pivot table meeting_user. I need to send mail all of the selected users for one meeting.
I am trying to send email using this but it's storing the meeting_id into notifiable_id column of db. so how can I store users_id in the notifiable_id column of db.
$meetings->save();
$meetings->users()->attach($request->user_id);
$users = Meeting::with('users')->get();
\Mail::to($user->send(New NewMeeting($meetings('id')));
There are two scenarios in which you can send an email to users to the meeting:
When the user has been added to the meeting
When alerting all users (in bulk) of a meeting which they have been added to.
When emailing the user which has just been added
In the event where you would like to email the users once added, you can do the following:
...
$meeting = Meeting::find($meeting_id);
$user = User::find($request->user_id);
$meeting->users()->attach($user->id);
\Notification::send($user, new NewMeetingNotification($user));
This is to be added within code which only adds a user to a meeting, not multiple users.
When emailing all users within a meeting at once
In the event where you would like to email users, in bulk, once you've added all users, you can do the following.
...
$meeting = Meeting::with('users')->where('id', $meeting_id)->first();
$meeting->users()->each(function ($user, $key) {
\Notification::send($user, new NewMeetingNotification($user));
});
$meeting_id being the meeting in question.
Notify User (Optional)
If the user model has the notifiable trait, you can change the code to:
...
$meeting = Meeting::with('users')->where('id', $meeting_id)->first();
$meeting->users()->each(function ($user, $key) {
$user->notify(new NewMeetingNotification($user));
});
I hope this helps.
I am using cakephp and am new to it. I have created public and private groups in my website. How do i make sure only members can view the content of private groups and not everyone.
The SQL Tables are -
Users-
id
created
modified
email
password
Groups-
id
name
type - has value 1 if group is private and 0 if group is public
Groups_Users
id
group_id
user_id
created
modified
Please if someone can explain. Thank You
Are you using ACL ? if so you can create a "private" group & a method allowed to users belonging to that group (you can enhance it with routing prefix, but that's another subject)
It's as simple as : create method that fetch content -> create group -> give access rights to that group & that's it, only users belonging to that group can access that method.
If you're not using ACL, i suggest you to learn more about it it's time well spent. There's plugins which make it really easy to work with them & if you need more control you can create your own Authorization process.
I retrieve an appointment by its unique ID. Now I want to find out which mailbox it is in.
I tried using appointment.Organizer, but this does not work for meetings, or for normal appointments - since appointments can be moved around between mailboxes, the Organizer can be different from the user that has the appointment in his calendar.
Is there a function to get a folder, given only an appointment and an ExchangeService?
If you want to get the SMTP address of the mailbox associated with a particular EWSId one way that should work is using convertId to convert the EWSId to a StoreId and just use generic mailbox address in the Mailbox field then the results you get back (if that ID is good) should contain the Mailbox its associated with eg
String EWSId = "AQMkADY4ZDQ4M2UyLTRhYjItNDhkYy1hMG...";
AlternateId aiRequest = new AlternateId();
aiRequest.UniqueId = EWSId;
aiRequest.Mailbox = "user#mailbox.com";
aiRequest.Format = IdFormat.EwsId;
AlternateId aiResultsStore = (AlternateId)service.ConvertId(aiRequest, IdFormat.StoreId);
Console.WriteLine(aiResultsStore.Mailbox);
Cheers
Glen
I have been reading carefully through the MediaWiki documentation but I have not been able to find out how to create new groups.
When I look at Special:Userrights, I see only 3 groups :
Bots, Sysops, Bureaucrats
I would like to create my own custom groups, so I can use some extensions like the http://www.mediawiki.org/wiki/Extension:Group_Based_Access_Control.
Can someone tell me how it's done, or point me to some documentation?
You can add permissions for new groups to your LocalSettings.php file and they will automatically appear in the Special:UserRights page.
For example, I wanted to disallow editing by regular users but create a "Trusted" group that was allowed to edit. The following code creates a "Trusted" group that is equal to the "user" group, except that "Trusted" users can edit but "user" users cannot.
$wgGroupPermissions['Trusted'] = $wgGroupPermissions['user'];
$wgGroupPermissions['user' ]['edit'] = false;
$wgGroupPermissions['Trusted']['edit'] = true;
$wgGroupPermissions['sysop' ]['edit'] = true;
On the Special:UserRights page, I can now check the "Trusted" box to make users trusted.
You can alter the appearance of the group name by creating the following messages:
(For a group named ninja:)
MediaWiki:Group-ninja (content: Ninjas)
MediaWiki:Group-ninja-member (content: ninja)
MediaWiki:Grouppage-ninja (content: Project:Ninjas)
This will insure that the group will be referred to as "Ninjas" throughout the interface, and a member will be referred to as a "ninja", and overviews will link the groupname to Project:Ninjas.
(source: http://www.mediawiki.org/wiki/Manual:User_rights#Examples)
Here you will find a List of Permissions. http://www.mediawiki.org/wiki/Manual:User_rights
I beleive I have found the answer, I just need to add the UserGroup and the permission to the wgGroupPermissions array in the LocalSettings.php file.
$wgGroupPermissions['TomatoUsers']['read'] = true;
$wgGroupPermissions['TomatoUsers']['edit'] = false;
I don't have the reputation to vote up the first answer (which can also be added to extension initialization files), but for when you get to adding users to your groups you may want to consider directly editing the database (ie. if you need to sync the wiki groups with external information). If you open the database "wikidb" the "PREFIX_user_groups"* table contains the mapping between user IDs (ug_user) and group names (ug_group). This table, combined with the "PREFIX_user"* table's name information (user_name) and ID information (user_id), give you all the information to add and remove large numbers of users from groups.
* Replace "PREFIX" with the database prefix you used for your wiki.