Skip to content

Commit

Permalink
Exclude hidden lists from rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
koltyakov committed Mar 26, 2023
1 parent 79dcc6e commit 21c9af8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resources/ct/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (c *ContentTypesRollup) Sync(ctx context.Context, metrics *source.TableClie

// Iterate over all lists
for _, listID := range lists {
c.logger.Debug().Msgf("list sync: %s", listID)
if err := c.syncList(ctx, webURL, listID, metrics, res, table); err != nil {
return err
}
Expand Down Expand Up @@ -80,7 +81,13 @@ func (c *ContentTypesRollup) getWebs(webURL string) ([]string, error) {

func (c *ContentTypesRollup) getLists(webURL string, ctID string) ([]string, error) {
web := c.sp.Web().FromURL(fmt.Sprintf("%s/_api/Web", webURL))
resp, err := web.Lists().Select("Id,ContentTypes/StringId").Expand("ContentTypes").Top(5000).Get()

resp, err := web.Lists().
Select("Id,ContentTypes/StringId").
Filter("AllowContentTypes eq true and Hidden eq false").
Expand("ContentTypes").
Top(5000).Get()

if err != nil {
return nil, err
}
Expand Down

0 comments on commit 21c9af8

Please sign in to comment.