EDataServer.WebDAVSession.lock_resource_sync

### Method

# EDataServer WebDAVSessionlock_resource_sync

since: 3.26

#### Declaration [src]

    gboolean
    e_webdav_session_lock_resource_sync (
      EWebDAVSession* webdav,
      const gchar* uri,
      EWebDAVLockScope lock_scope,
      gint32 lock_timeout,
      const gchar* owner,
      gchar** out_lock_token,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Locks a resource identified by `uri`, or, in case it’s `NULL`, by the URI defined in associated `ESource`. It obtains a write lock with the given `lock_scope`.

The `owner` is used to identify the lock owner. When it’s an http:// or https://, then it’s referenced as DAV:href, otherwise the value is treated as plain text. If it’s `NULL`, then the user name from the associated `ESource` is used.

The `out_lock_token` can be refreshed with e_webdav_session_refresh_lock_sync(). Release the lock with e_webdav_session_unlock_sync(). Free the returned `out_lock_token` with g_free(), when no longer needed.

Available since: 3.26

#### Parameters

`uri`

  Type: `const gchar*`

  URI to lock, or `NULL` to read from `ESource`.

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

`lock_scope`

  Type: `EWebDAVLockScope`

  An `EWebDAVLockScope` to define the scope of the lock.

`lock_timeout`

  Type: `gint32`

  Timeout for the lock, in seconds, on 0 to infinity.

`owner`

  Type: `const gchar*`

  Optional identificator of the owner of the lock, or `NULL`.

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

`out_lock_token`

  Type: `gchar**`

  Return location of the obtained or refreshed lock token.

  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.