function CreateGroup(Titulo: PAnsiChar): PChar; stdcall;
var
XMLDoc: TNativeXml;
ListaNodos: TXmlNodeList;
Node: TXmlNode;
NodeExt: TXmlNode;
createRequest: string;
Send: Thttpsend;
RetornoString: AnsiString;
I: Integer;
lPostData: TStringList;
begin
Result := PChar('-1');
if ((AuthID <> '') and (Titulo <> '')) then
begin
XMLDoc := TNativeXml.Create;
XMLDoc.CreateName('atom:entry');
XMLDoc.Root.WriteAttributeString('xmlns:gd',
'http://schemas.google.com/g/2005');
XMLDoc.Root.WriteAttributeString('xmlns:atom',
'http://www.w3.org/2005/Atom');
Node := XMLDoc.Root.NodeNew('atom:category');
Node.WriteAttributeString('scheme',
'http://schemas.google.com/g/2005#kind');
Node.WriteAttributeString('term',
'http://schemas.google.com/contact/2008#group');
Node := XMLDoc.Root.NodeNew('atom:title');
Node.WriteAttributeString('type', 'text');
Node.ValueAsUnicodeString := String(Titulo);
NodeExt := XMLDoc.Root.NodeNew('gd:extendedProperty');
NodeExt.WriteAttributeString('name', 'more info about the group');
Node := NodeExt.NodeNew('info');
Node.ValueAsUnicodeString := 'Nice people.';
XMLDoc.SaveToFile('C:\CarlosP.xml');
Send := Thttpsend.Create;
Send.MimeType := 'application/atom+xml';
Send.Headers.Clear;
Send.Headers.Add('GData-Version: 3.0');
Send.Headers.Add('Authorization: GoogleLogin auth=' + AuthID);
XMLDoc.SaveToStream(Send.Document);
try
if (Send.HTTPMethod('POST','https://www.google.com/m8/feeds/groups/default/full')) then
begin
Application.MessageBox(PChar(inttostr(Send.ResultCode)), '', 0);
end;
Application.MessageBox(PChar(inttostr(Send.ResultCode)), '', 0);
except
on e: Exception do
Application.MessageBox(PChar(e.ToString), '', 0); end;
end;
end;