Replies: 8 comments
-
Update on this. It's something to do with my subsite. If I connect to one level below, |
Beta Was this translation helpful? Give feedback.
-
Yeah you need to connect to the site or subsite where pages reside to retrieve them. |
Beta Was this translation helpful? Give feedback.
-
@gautamdsheth I don't understand why this was closed, what's the work around for the issue? I need to be able to access pages on the /product/development/repos/ site. If I connect to that site, I get an exception. I can connect to and access pages on the parent site just fine. Can you provide me with a way to connect to /development/repos and access pages on /development/repos/ without getting the exception? Is there anything I need to configure on the site for this to work? I'm an owner of the site so I don't think it's permissions. Why does the cmdlet work on one site, but not another? Sorry if my question doesn't make sense. Please feel free to ask me more questions instead of closing the bug. We really need to get this working. |
Beta Was this translation helpful? Give feedback.
-
@mike-christensen - No issue here getting pages on subsites |
Beta Was this translation helpful? Give feedback.
-
@veronicageek Yea, it must be something to do with the actual site since I can connect and get pages on some subsites, but not others.. The "Object reference not set to an instance of an object." exception is quite vague. Is there a way to get more details about the problem? |
Beta Was this translation helpful? Give feedback.
-
Ok I assumed that the issue is fixed because you mentioned it yourself that you connected to subsite and it started working. Also Get-PnPPage is used to get modern pages from site pages library. If you point it towards publishing pages or wiki pages , it will not work as it is not supported . This command is not intended to work with other libraries like Pages library and fetch publishing pages. |
Beta Was this translation helpful? Give feedback.
-
@gautamdsheth Ok that makes sense. My end goal is to create and publish my own HTML page, but have it have the site master page and menus/navigation. I can publish a "document", which I've gotten to work, but then I'm responsible for 100% of the HTML. Basically, we're looking at Sharepoint as a way to host some content we create using a script that generates a bunch of HTML.. We could probably use an App Service or something, but then we'd have to implement authentication and all that boring stuff. I've posted this question on StackExchange in hopes of getting someone to help me. Maybe you can point me in the right direction, since it seems that the "PnPPage" Cmdlets might not be what I'm looking for. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Moving this to a discussion |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Reporting an Issue or Missing Feature
Issue
Expected behavior
Should return Page object
Actual behavior
Throws exception
Steps to reproduce behavior
First, I connect to my site like so:
I can run `Get-PnPFolderItem -Identity "Pages" and see:
Next, I try to get one of the sites with
I get the following exception:
The
Get-PnPException
command returns:Note, I can put anything I want for the identity:
and I get the same exception, so I don't think it's even getting to the part of looking up the site.
I think this might be due to the way I connect to the site, but I'm not sure of another way to do it. I think either Get-PnPPage doesn't support subsites (or nested subsites?) or it doesn't support whatever auth method I'm using.
What is the version of the Cmdlet module you are running?
1.9.0
Which operating system/environment are you running PnP PowerShell on?
Windows
Beta Was this translation helpful? Give feedback.
All reactions