KDE 4.2 PyKDE API Reference

- KDE's Python API

# ItemCreateJob Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi

## Detailed Description

Job that creates a new item in the Akonadi storage.

This job creates a new item with all the set properties in the given target collection.

Example:

     // Create a contact item in the root collection

     KABC.Addressee addr;
     addr.setNameFromString( "Joe Jr. Miller" );

     Akonadi.Item item;
     item.setMimeType( "text/directory" );
     item.setPayload<KABC.Addressee>( addr );

     Akonadi.Collection collection = Akonadi.Collection.root();

     Akonadi.ItemCreateJob *job = new Akonadi.ItemCreateJob( item, collection );

     if ( job->exec() )
       qDebug() << "Contact item created successfully";
     else
       qDebug() << "Error occurred";

Author:
  Volker Krause <vkrause@kde.org>

## Methods

| __init__ (self, Akonadi.Item item, Akonadi.Collection collection, QObject parent=0)
| doHandleResponse (self, QByteArray tag, QByteArray data)
| doStart (self)
Akonadi.Item | item (self)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Item | item,
|  | Akonadi.Collection | collection,
|  | QObject | parent=0
| ) |  |  |

Creates a new item create job.

Parameters:

  | item | The item to create.

Note:
  It must have a mime type set.

Parameters:

  | collection | The parent collection where the new item shall be located in.
  | parent | The parent object.

doHandleResponse | ( | self, |
|  | QByteArray | tag,
|  | QByteArray | data
| ) |  |  |

doStart | ( |  | self ) |

Akonadi.Item item | ( |  | self ) |

Returns the created item with the new unique id, or an invalid item if the job failed.