Ok,
Here is my solution, like it or not =)
Find's .sis file from inbox which has mach to KMachSis literal and is received via BT. Also it's newest file which maches KMachSis. When file is found it's copied to C:\data so that it can be send forward. Sorry for poor commenting.
Code:
CMsvSession* session = CMsvSession::OpenSyncL(*this);
if(session)
{
TMsvSelectionOrdering sort;
sort.SetShowInvisibleEntries(ETrue);
sort.SetSorting(EMsvSortByDate);
// Take a handle to the folder entry
CMsvEntry* parentEntry = CMsvEntry::NewL(*session,KMsvGlobalInBoxIndexEntryId, sort);
CleanupStack::PushL(parentEntry);
// A selection of all BT entries
CMsvEntrySelection* entries = parentEntry->ChildrenWithMtmL(KUidMsgTypeBt);
CleanupStack::PushL(entries);
//Process all entries
for(TInt i = 0; i < entries->Count(); i++)
{
//Get entry
CMsvEntry* btEntry = session->GetEntryL((*entries)[i]);
CleanupStack::PushL(btEntry);
//Then get entrys child
CMsvEntrySelection* btChildren = btEntry->ChildrenL();
CleanupStack::PushL(btChildren);
TInt childc = btChildren->Count();
if (childc>0)
{
for(TInt i=0; i<childc; i++)
{
TMsvId btAtt = (*btChildren)[i];
btEntry->SetEntryL(btAtt);
if (btEntry->HasStoreL())
{
CMsvStore* store = btEntry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
TInt attcount = attMngr.AttachmentCount();
for(TInt j=0; j<attcount; j++)
{
CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(j);
if(attachment->AttachmentName().Match(KMatchSis))
{
RFile file = attMngr.GetAttachmentFileL(j);
TInt size;
file.Size(size);
TFileName copyfileName;
copyfileName.Copy( _L("C:\\Data\\application.sis_"));
RFile toFile;
RFs iSession;
iSession.Connect();
TInt delerr = iSession.Delete(copyfileName);
if(delerr == KErrNotFound || delerr == KErrNone)
{
toFile.Create(iSession,copyfileName,EFileWrite);
HBufC8* bufferDes = NULL;
bufferDes = HBufC8::NewLC(size);
TPtr8 BDPointer(bufferDes->Des());
User::LeaveIfError(file.Read(BDPointer, size));
User::LeaveIfError(toFile.Write(BDPointer,size));
toFile.Flush();
toFile.Close();
iFilePaths->AppendL(copyfileName);
}
else
{
}
file.Close();
iSession.Close();
CleanupStack::Pop();//bufferDes
}
}
CleanupStack::PopAndDestroy(store);
}
}
}
CleanupStack::PopAndDestroy(2);
}
CleanupStack::PopAndDestroy(2);
}