EDataServer.WebDAVSession.lock_sync

### Method

# EDataServer WebDAVSessionlock_sync

since: 3.26

#### Declaration [src]

    gboolean
    e_webdav_session_lock_sync (
      EWebDAVSession* webdav,
      const gchar* uri,
      const gchar* depth,
      gint32 lock_timeout,
      const EXmlDocument* xml,
      gchar** out_lock_token,
      xmlDoc** out_xml_response,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Locks a resource identified by `uri`, or, in case it’s `NULL`, on the URI defined in associated `ESource`.

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.

If provided, free the returned `out_xml_response` with xmlFreeDoc(), 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.

`depth`

  Type: `const gchar*`

  Requested depth, can be one of `E_WEBDAV_DEPTH_THIS` or `E_WEBDAV_DEPTH_INFINITY`.

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

`lock_timeout`

  Type: `gint32`

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

`xml`

  Type: `EXmlDocument`

  An XML describing the lock request, with DAV:lockinfo root element.

  The data is owned by the caller of the method.

`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.

`out_xml_response`

  Type: `xmlDoc`

  Optional return location for the server response as #xmlDocPtr.

  The argument will be set by the function.
  The argument can be set to `NULL` by the method.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`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.