### Function

# Secret Item create_sync

#### Declaration [src]

    SecretItem*
    secret_item_create_sync (
      SecretCollection* collection,
      const SecretSchema* schema,
      GHashTable* attributes,
      const gchar* label,
      SecretValue* value,
      SecretItemCreateFlags flags,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Create a new item in the secret service.

If the `flags` contains `SECRET_ITEM_CREATE_REPLACE`, then the secret service will search for an item matching the `attributes`, and update that item instead of creating a new one.

This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. `secret_service_prompt()` will be used to handle any prompts that are required.

#### Parameters

`collection`

  Type: `SecretCollection`

  A secret collection to create this item in.

  The data is owned by the caller of the function.

`schema`

  Type: `SecretSchema`

  The schema for the attributes.

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

`attributes`

  Type: `GHashTable`

  Attributes for the new item.

  The data is owned by the caller of the function.

`label`

  Type: `const gchar*`

  Label for the new item.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`value`

  Type: `SecretValue`

  Secret value for the new item.

  The data is owned by the caller of the function.

`flags`

  Type: `SecretItemCreateFlags`

  Flags for the creation of the new item.

`cancellable`

  Type: `GCancellable`

  Optional cancellation object.

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

`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 function 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: `SecretItem`

The new item, which should be unreferenced with `g_object_unref()`.

The caller of the function takes ownership of the data, and is responsible for freeing it.