GC: Sharepoint: List: Delete feature added (#2017)
## Description Adds the ability to delete a from a SharePoint Site for purge script <!-- Insert PR description--> ## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> *related to #2016 <issue>
This commit is contained in:
parent
229e7a48b7
commit
5239ff97e3
@ -2,6 +2,7 @@ package sharepoint
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
mssite "github.com/microsoftgraph/msgraph-sdk-go/sites"
|
mssite "github.com/microsoftgraph/msgraph-sdk-go/sites"
|
||||||
@ -356,3 +357,19 @@ func fetchColumnLinks(
|
|||||||
|
|
||||||
return links, nil
|
return links, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteList removes a list object from a site.
|
||||||
|
func DeleteList(
|
||||||
|
ctx context.Context,
|
||||||
|
gs graph.Servicer,
|
||||||
|
siteID, listID string,
|
||||||
|
) error {
|
||||||
|
err := gs.Client().SitesById(siteID).ListsById(listID).Delete(ctx, nil)
|
||||||
|
errorMsg := fmt.Sprintf("failure deleting listID %s from site %s. Details: %s",
|
||||||
|
listID,
|
||||||
|
siteID,
|
||||||
|
support.ConnectorStackErrorTrace(err),
|
||||||
|
)
|
||||||
|
|
||||||
|
return errors.Wrap(err, errorMsg)
|
||||||
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ func (suite *SharePointSuite) SetupSuite() {
|
|||||||
func TestSharePointSuite(t *testing.T) {
|
func TestSharePointSuite(t *testing.T) {
|
||||||
if err := tester.RunOnAny(
|
if err := tester.RunOnAny(
|
||||||
tester.CorsoCITests,
|
tester.CorsoCITests,
|
||||||
|
tester.CorsoGraphConnectorSharePointTests,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
t.Skip(err)
|
t.Skip(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user