### Method

# EDataBook BookMetaBackend save_contact_sync

since: 3.26

#### Declaration [src]

    gboolean
    e_book_meta_backend_save_contact_sync (
      EBookMetaBackend* meta_backend,
      gboolean overwrite_existing,
      EConflictResolution conflict_resolution,
      EContact* contact,
      const gchar* extra,
      guint32 opflags,
      gchar** out_new_uid,
      gchar** out_new_extra,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Saves one contact into the remote side. When the `overwrite_existing` is `TRUE`, then the descendant can overwrite an object with the same UID on the remote side (usually used for modify). The `conflict_resolution` defines what to do when the remote side had made any changes to the object since the last update.

The `contact` has already converted locally stored photos and logos into inline variants, thus it’s not needed to call `e_book_meta_backend_inline_local_photos_sync()` by the descendant.

The `out_new_uid` can be populated with a UID of the saved contact as the server assigned it to it. This UID, if set, is loaded from the remote side afterwards, also to see whether any changes had been made to the contact by the remote side.

The `out_new_extra` can be populated with a new extra data to save with the contact. Left it `NULL`, to keep the same value as the `extra`.

The descendant can use an #E_CLIENT_ERROR_OUT_OF_SYNC error to indicate that the save failed due to made changes on the remote side, and let the `meta_backend` resolve this conflict based on the `conflict_resolution` on its own. The #E_CLIENT_ERROR_OUT_OF_SYNC error should not be used when the descendant is able to resolve the conflicts itself.

It is mandatory to implement this virtual method by the writable descendant.

Available since: 3.26

#### Parameters

`overwrite_existing`

  Type: `gboolean`

  `TRUE` when can overwrite existing contacts, `FALSE` otherwise.

`conflict_resolution`

  Type: `EConflictResolution`

  One of `EConflictResolution`, what to do on conflicts.

`contact`

  Type: `EContact`

  An `EContact` to save.

  The data is owned by the caller of the method.

`extra`

  Type: `const gchar*`

  Extra data saved with the contacts in an `EBookCache`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`opflags`

  Type: `guint32`

  Bit-or of EBookOperationFlags.

`out_new_uid`

  Type: `gchar**`

  Return location for the UID of the saved contact.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`out_new_extra`

  Type: `gchar**`

  Return location for the extra data to store with the contact.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

Whether succeeded.