1

I wonder why when I execute this two lines

$wpDestinationPageFullUrl = "http://root/sites/SitioModelo/TestLoadWebPart/SitePages/HomeTest.aspx"
$siteUrl = "http://root/sites/SitioModelo/TestLoadWebPart/"
$Web = Get-SPWeb -identity $siteUrl
$spFile = $Web.GetFile($wpDestinationPageFullUrl)

in the console when I type $spFile show me this output

EffectiveRawPermissions : 
EffectiveAuditMask      : 
Exists                  : False
Properties              : 
ForwardLinks            : 
BackwardLinks           : 
Title                   : 
Length                  : 
TotalLength             : 
LengthByUser            : 
Author                  : 
ModifiedBy              : 
TimeCreated             : 
TimeLastModified        : 
CustomizedPageStatus    : 
ETag                    : 
LockType                : 
LockId                  : 
LockedDate              : 
LockExpires             : 
LockedByUser            : 
CheckOutStatus          : 
CheckOutType            : 
CheckedOutDate          : 
CheckOutExpires         : 
CheckedOutBy            : 
CheckedOutByUser        : 
CheckInComment          : 
Generator               : 
CharSetName             : 
ProgID                  : 
UIVersion               : 
MajorVersion            : 
MinorVersion            : 
UIVersionLabel          : 
ParentFolder            : SitePages
Url                     : SitePages/Home.aspx
UniqueId                : 44cdd661-401d-4aa7-8b0b-149067408996
ServerRelativeUrl       : /sites/testsite/childtest/SitePages/Home.aspx
IconUrl                 : ichtm.gif
Name                    : Home.aspx
RequiresCheckout        : 
DocumentLibrary         : 
Versions                : 
Item                    : 
ListItemAllFields       : 
InDocumentLibrary       : 
Level                   : 
IsConvertedFile         : 
SourceLeafName          : 
SourceUIVersion         : 
GeneratingConverterId   : 
SourceFile              : 
Web                     : 
ServerRedirected        : 
IsIRMed                 : False
IsSharedAccessRequested : False
EventReceivers          :

Why many properties are empty? There is an error en my page? Maybe I have to configure this site?

Thanks!

1

I think your file does not exist, or you are not setting the url parameter correctly.

Double check $wpDestinationPageFullUrl.

$web.GetFile

OverloadDefinitions
-------------------
Microsoft.SharePoint.SPFile GetFile(string strUrl)
Microsoft.SharePoint.SPFile GetFile(guid uniqueId)
  • The value of the variable should be the full url? I mean I have this "root/sites/SitioModelo/TestLoadWebPart/SitePages/HomeTest.aspx" is a page that I create to test and the url is exaclty like that. – eflores Aug 17 '17 at 14:03
  • because you don't show us your actual urls, it's hard to see what you are doing. I suggest that you instantiate SPWeb object based on the same website url as the one the file is located in. – Tiago Duarte Aug 17 '17 at 14:39
  • Ok sorry.. I updated the snipped. – eflores Aug 17 '17 at 15:30
  • 1
    try $wpDestinationPageFullUrl = "/sites/SitioModelo/TestLoadWebPart/SitePages/HomeTest.aspx" – Tiago Duarte Aug 18 '17 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.