cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BoyDrijvers
Frequent Visitor

ForAll with Office365GroupsMail.GetAttachments Connector doesn't loop.

i got a problem with a ForAll Loop with a Connector in it;

 

at the Second For All Loop(as ltp2) i'm making a Nested Collection;

The key values of ThreatID and PostID in this loop are unique combination.

but when i use the the same values within the Office365Groupsmail connector. that i just to get the attachment from this email at AttachmentInfo. it runs every time the first key values of the Collection.

 

anyone know why the forall doesn't work on the Connector;

Code;  

 

 

 

ForAll(GroupThreadsV2 As gtv2,
    If(Not(gtv2.id in Bijlage.Threatid),
        Collect(ListThreadPostsTemp, Office365GroupsMail.ListThreadPosts(GroupIDVar , gtv2.id ).value);
        ForAll(ListThreadPostsTemp As ltpt2,
            If(Not(gtv2.id in ListThreadPosts.Threatid),
                Collect(ListThreadPosts, Table({
                    Threatid: gtv2.id,
                    Postid: ltpt2.id,
                    body: ltpt2.body,
                    emailSender: ltpt2.from
                }))))));

ForAll(ListThreadPosts As ltp2,
    Collect(Bijlage, Table({
        Threatid: ltp2.Threatid,
        Postid: ltp2.Postid,
        body: ltp2.body,
        emailSender: ltp2.emailSender,
        AttachmentInfo:Office365GroupsMail.GetAttachments(GroupIDVar, ltp2.Threatid, ltp2.Postid).value
        })));
Clear(ListThreadPosts);
Clear(ListThreadPostsTemp);

 

 

 

 

Collection name; listthreadPosts

BoyDrijvers_1-1632827549710.png

Collection Bijlage;

BoyDrijvers_2-1632827601920.png

NestedCollection Bijlage.AttachmentInfo ;

are all the same;

BoyDrijvers_3-1632827664205.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BoyDrijvers
Frequent Visitor

i solved it myself code is below;

ForAll(GroupThreadsV1 As gtv2,
    If(Not(gtv2.id in Bijlage.Threatid),
        Collect(ListThreadPostsTemp,Table({
            ThreatID: gtv2.id, 
            PostInfo: Office365GroupsMail.ListThreadPosts(GroupIDVar , gtv2.id ).value}));
        ForAll(ListThreadPostsTemp As ltpt2,
            If(Not(ltpt2.ThreatID in ListThreadPosts.Threatid),
                Collect(ListThreadPosts, Table({
                    Threatid: ltpt2.ThreatID,
                    Postid: First(ltpt2.PostInfo).id,
                    body: First(ltpt2.PostInfo).body,
                    emailSender: First(ltpt2.PostInfo).from
                }))));
                Patch(GroupThreadsV2,{id: gtv2.id},{Status: 1});
                ));

ForAll(ListThreadPosts As ltp2,
    If(Not(ltp2.Threatid in Bijlage.Threatid),
        Collect(Bijlage, Table({
            Threatid: ltp2.Threatid,
            Postid: ltp2.Postid,
            body: ltp2.body,
            emailSender: ltp2.emailSender,
            AttachmentInfo: Office365GroupsMail.GetAttachments(GroupIDVar, ltp2.Threatid, ltp2.Postid).value
        }));
        Patch(GroupThreadsV2,{id: ltp2.Threatid},{Status: 2})
        ));
Clear(ListThreadPostsTemp);

 

View solution in original post

1 REPLY 1
BoyDrijvers
Frequent Visitor

i solved it myself code is below;

ForAll(GroupThreadsV1 As gtv2,
    If(Not(gtv2.id in Bijlage.Threatid),
        Collect(ListThreadPostsTemp,Table({
            ThreatID: gtv2.id, 
            PostInfo: Office365GroupsMail.ListThreadPosts(GroupIDVar , gtv2.id ).value}));
        ForAll(ListThreadPostsTemp As ltpt2,
            If(Not(ltpt2.ThreatID in ListThreadPosts.Threatid),
                Collect(ListThreadPosts, Table({
                    Threatid: ltpt2.ThreatID,
                    Postid: First(ltpt2.PostInfo).id,
                    body: First(ltpt2.PostInfo).body,
                    emailSender: First(ltpt2.PostInfo).from
                }))));
                Patch(GroupThreadsV2,{id: gtv2.id},{Status: 1});
                ));

ForAll(ListThreadPosts As ltp2,
    If(Not(ltp2.Threatid in Bijlage.Threatid),
        Collect(Bijlage, Table({
            Threatid: ltp2.Threatid,
            Postid: ltp2.Postid,
            body: ltp2.body,
            emailSender: ltp2.emailSender,
            AttachmentInfo: Office365GroupsMail.GetAttachments(GroupIDVar, ltp2.Threatid, ltp2.Postid).value
        }));
        Patch(GroupThreadsV2,{id: ltp2.Threatid},{Status: 2})
        ));
Clear(ListThreadPostsTemp);

 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,143)