## Description SharePoint details has a field `ParentPath`. This PR populates that field. Requires an additional call per collection to retrieve the Site's webURL. <!-- Insert PR description--> ## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change - [x] 🧹 Tech Debt/Cleanup ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package sharepoint
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/alcionai/corso/src/internal/connector/graph/betasdk/models"
|
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
|
)
|
|
|
|
// sharePointPageInfo propagates metadata from the SharePoint Page data type
|
|
// into searchable content.
|
|
// Page Details: https://learn.microsoft.com/en-us/graph/api/resources/sitepage?view=graph-rest-beta
|
|
func sharePointPageInfo(page models.SitePageable, root string, size int64) *details.SharePointInfo {
|
|
var (
|
|
name, prefix, webURL string
|
|
created, modified time.Time
|
|
)
|
|
|
|
if page.GetTitle() != nil {
|
|
name = *page.GetTitle()
|
|
}
|
|
|
|
if page.GetWebUrl() != nil {
|
|
if len(root) > 0 {
|
|
prefix = root + "/"
|
|
}
|
|
|
|
webURL = prefix + *page.GetWebUrl()
|
|
}
|
|
|
|
if page.GetCreatedDateTime() != nil {
|
|
created = *page.GetCreatedDateTime()
|
|
}
|
|
|
|
if page.GetLastModifiedDateTime() != nil {
|
|
modified = *page.GetLastModifiedDateTime()
|
|
}
|
|
|
|
return &details.SharePointInfo{
|
|
ItemType: details.SharePointItem,
|
|
ItemName: name,
|
|
ParentPath: root,
|
|
Created: created,
|
|
Modified: modified,
|
|
WebURL: webURL,
|
|
Size: size,
|
|
}
|
|
}
|