Use path struct in recovery of exchange (#837)
Preparation for data.Collection.FullPath returning path.Path instead of []string.
This commit is contained in:
parent
226489c58f
commit
1d39d911ca
@ -6,7 +6,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
stdpath "path"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
||||||
@ -260,19 +260,25 @@ func (gc *GraphConnector) RestoreExchangeDataCollection(
|
|||||||
|
|
||||||
for _, dc := range dcs {
|
for _, dc := range dcs {
|
||||||
var (
|
var (
|
||||||
user string
|
items = dc.Items()
|
||||||
category path.CategoryType
|
exit bool
|
||||||
directory = strings.Join(dc.FullPath(), "")
|
|
||||||
items = dc.Items()
|
|
||||||
// TODO(ashmrtn): Update this when we have path struct support in collections.
|
|
||||||
exit bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
category = path.ToCategoryType(dc.FullPath()[3])
|
// TODO(ashmrtn): Remove this when data.Collection.FullPath supports path.Path
|
||||||
user = dc.FullPath()[2]
|
directory, err := path.FromDataLayerPath(
|
||||||
|
stdpath.Join(dc.FullPath()...),
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
errs = support.WrapAndAppend("parsing Collection path", err, errs)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := pathCounter[directory]; !ok {
|
category := directory.Category()
|
||||||
pathCounter[directory] = true
|
user := directory.ResourceOwner()
|
||||||
|
|
||||||
|
if _, ok := pathCounter[directory.String()]; !ok {
|
||||||
|
pathCounter[directory.String()] = true
|
||||||
folderID, errs = exchange.GetRestoreContainer(&gc.graphService, user, category)
|
folderID, errs = exchange.GetRestoreContainer(&gc.graphService, user, category)
|
||||||
|
|
||||||
if errs != nil {
|
if errs != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user