I am trying to find out all the site owners within a site. (I need to run this for 100 sites). Please note I am not looking for Site Collections Admins. I am using Sharepoint 2007. I have been trying to solve this issue for weeks but have had no joy so please help. I am new to Sharepoint so if I am missing something simple please pardon my ignorance. I tried your power shell command and it bought up to enter the site url which I put in and got the error message below:-
New-Object : Cannot find type [Microsoft.SharePoint.SPSite]: make sure the assembly containing this type is loaded.
At line:4 char:23
+ $rootSite = New-Object <<<< Microsoft.SharePoint.SPSite($siteUrl)
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:20 char:18
$site.Dispose <<<< ()
CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException
FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:23 char:18
+ $rootSite.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Thanks
Romario
Related
I use the following to show a messagebox where I would like some info to be alligned using a TAB char.
This is working OK on Windows XP but not on Windows 7 (I have no Windows 8 to test).
ShowMessage(lSearch + sLineBreak +
'Breddegrad: ' + Chr(9) + HAMInfo.Latitude + sLineBreak +
'Længdegrad: ' + Chr(9) + HAMInfo.Longitude + sLineBreak +
'QRA locator: ' + Chr(9) + HAMInfo.Qra);
What other options are there if this can't be fixed to work on Windows 7?
Delphi XE3
The other variant is using ShowMessageFmt or using format function explicitly before calling ShowMessage.
But due to default fonts being proportional rather than fixed-width, it would still not result in a fine equal alignment.
http://www.delphibasics.co.uk/RTL.asp?Name=ShowMessageFmt
http://delphi.about.com/library/rtl/blrtlShowMessageFmt.htm
.
ShowMessageFmt('%s'#13#10 +
'%-16s%s'#13#10 + '%-16s%s'#13#10 + '%-16s%s',
[ lSearch , 'Breddegrad:', HAMInfo.Latitude,
'Længdegrad:', HAMInfo.Longitude,
'QRA locator:', HAMInfo.Qra ] );
i cant seem to figured out why i cant install nuget pakcage
ive tried running this in visual studio 2010 package manager
Install-Package MvcMailer
but i get an error shown below
PM> install-package MvcMailer
Install-Package : The context is already tracking a different entity with the same resource Uri.
At line:1 char:16
+ install-package <<<< MvcMailer
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM>
any ideas how to resolve this issue? tnx
From MSDN:
this error will occur if deserialized type dont really match the data Type of the entity being tracked. a fix for this is via using no tracking option.
more information can be found here
http://msdn.microsoft.com/en-us/library/system.data.services.client.mergeoption.aspx
also, it is advisable to use a new, different Data Service Context for every logical operation like insert and queries context.
I have the following code:
<div class="rep_td0">#(parseInt(d.RowKey.substr(2, 2)) + "." + parseInt(d.RowKey.substr(4, 2)))</div>
Getting an error saying that:
Compiler Error Message: CS0103: The name 'parseInt' does not exist in the current context
I thought this would work but can't understand why I get the error message. Does anyone have any idea what I might be doing wrong?
Can't you do int.Parse(d.RowKey.substr(2, 2))?
I have given up tryng to figure out the reason of this issue, but here is the story and hope you could give a tip...
As I develop unique app ( http://code.google.com/p/sedev ) and therefore I need to polish it.
I have to add File Summary ( very useful info in my opinion ) to any created files by the app, so I decided to go with NTFS compatible structure
edit: code snippet in which problem occurs:
if (FileExists(BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp') = True) then // add NTFS descriptive information to output file
try
SetFileSummaryInfo
(PWideChar(BaseLocation + LeftStr(GetSSWData, Length
(GetSSWData) - 1) + '.vkp')); // in my testcase files full path is: C:\Documents and Settings\Kludge\Desktop\sedevrpg\SEDEV_RPG_O_710.vkp
ShowMessagePos('Patch Created successfuly!' + #13#13 +
'Please verify created data to www.se-developers.net.',
ParamStr2X, ParamStr3Y);
MessageBeep(0);
except // exception handler does not even fire on exception ...
on Exception do
begin
if (WarningChBx.Checked = True) then
ShowMessagePos
('Unable to add Description to Output file (' +
BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp )', ParamStr2X, ParamStr3Y);
MessageBeep(0);
end;
end
final edit by author: Problem was in SetFileSummaryInfo(PWideChar('')) because after PWideChar conversion you got CHARACTER, not Array of Characters ( aka Strings ) therefore it is not valid path anymore!
Here is main tutorial: http://www.delphipages.com/articles/setting_file_summary_information-9228.html
edit: a better formatted tutorial is here.
BUT, the thing is that I just cannot get that damned FileName param to accept any string ... I have EOleSysError exception: "%1 cannot be found" no matter what.
Faulting operand is:
OleCheck(StgOpenStorageEx(PWideChar(FileName),
STGM_SHARE_EXCLUSIVE or STGM_READWRITE,
STGFMT_ANY,
0, nil, nil, #IID_IPropertySetStorage, stg));
What I do not understand is why it actually wants %1 MSDOS file name input.
I am not launching app from CMD therefore I highly doubt it needs additional param for File path ...
I have tried all possible String and PString conversions, also tried various param passing methods ... It just does not work ...
Any help appreciated!
I can only reproduce your case by specifying an invalid filename. Make sure that you include the full path in your filename.
Unfortunately I am not writing this question from my Developing PC so I might do some mistakes. Please sorry about it...
So - my question - what approach you use to implement error logging in your application?
In web ( http://delphi.about.com ) is nice event handler, but it just copies system error in file, but I would like to expand its capabilities by trapping memory and stack ( and processor information, if I will have time ). Should I aware if I call it dynamically, not adding its component on the form?
procedure TForm1.ApplicationEvents1Exception(Sender: TObject; E: Exception) ;
var
ErrorLogFileName : string;
ErrorFile : TextFile;
ErrorData : string;
begin
ErrorLogFileName := ChangeFileExt(Application.ExeName,'.error.log') ;
AssignFile(ErrorFile, ErrorLogFileName) ;
//either create an error log file, or append to an existing one
if FileExists(ErrorLogFileName) then
Append(ErrorFile)
else
Rewrite(ErrorFile) ;
try
//add the current date/time and the exception message to the log
ErrorData := Format('%s : %s',[DateTimeToStr(Now),E.Message]) ;
WriteLn(ErrorFile,ErrorData) ;
finally
CloseFile(ErrorFile)
end;
//Show the exception
Application.ShowException(E) ;
end;
... and http://delphi.about.com/cs/adptips2001/a/bltip0101_2.htm
As we know, Delphi also provides memory management a bit like C - using ampersands and Pascal functions, but what would be the most effective logging?
Thanks before! Hopefully this topic will be useful to other quality programmers.
Might be worth looking at third party components instead of writing something yourself. Both EurekaLog and madExcept do pretty much exactly what you're after. Both give great output and have support to connect into bug tracking systems like FogBugz, Mantis and BugZilla. With that you can actually collate the bug reports you're getting, spot common patterns and hopefully fix bugs quicker.
Personally, installing the Jedi JVCL / JCL is a bit overkill for just it's exception tracking since it's a fairly hefty install. Both of the above I've mentioned are commercial products, but you get what you pay for.
IIUC, you want a stack trace report with line numbers, system info etc. IOW something like this:
Exception class: EVariantTypeCastError
Exception address: 004170ED
------------------------------------------------------------------------------
Stack list, generated 12/7/2009 11:32:19
[004170E8]{A.exe } Variants.HandleConversionException (Line 614, "sys\variants.pas" + 10)
[0057ACAC]{A.exe } cxDataStorage.TcxSmallintValueType.SetDataValue (Line 1067, "cxDataStorage.pas" + 2)
[005AC6C5]{A.exe } cxCustomData.TcxCustomDataController.SetStoredValue (Line 12752, "cxCustomData.pas" + 2)
[005A8AD3]{A.exe } cxCustomData.TcxCustomDataController.SetValue (Line 10401, "cxCustomData.pas" + 12)
[0059DA0B]{A.exe } cxCustomData.TcxCustomDataProvider.SetEditValue (Line 3180, "cxCustomData.pas" + 4)
[005A8F9B]{A.exe } cxCustomData.TcxCustomDataController.SetEditValue (Line 10560, "cxCustomData.pas" + 2)
[0066EBBE]{A.exe } cxGridCustomTableView.TcxCustomGridTableItem.SetEditValue (Line 14396, "cxGridCustomTableView.pas" + 1)
[006637C5]{A.exe } cxGridCustomTableView.TcxGridEditingController.UpdateValue (Line 7474, "cxGridCustomTableView.pas" + 4)
[00673F30]{A.exe } cxGridCustomTableView.TcxCustomGridTableView.UpdateRecord (Line 17771, "cxGridCustomTableView.pas" + 1)
[0059D97F]{A.exe } cxCustomData.TcxCustomDataProvider.PostEditingData (Line 3170, "cxCustomData.pas" + 1)
[00A80870]{A.exe } fFilterLine.TFilterLine.UMLayoutChanged (Line 1034, "fFilterLine.pas" + 0)
[00482DBF]{A.exe } Controls.TWinControl.WndProc (Line 7304, "Controls.pas" + 111)
[004824E8]{A.exe } Controls.TWinControl.MainWndProc (Line 7073, "Controls.pas" + 3)
[00431D84]{A.exe } Classes.StdWndProc (Line 11583, "common\Classes.pas" + 8)
[0049F981]{A.exe } Forms.TApplication.MessageBox (Line 8293, "Forms.pas" + 22)
[0049FA99]{A.exe } Forms.TApplication.ShowException (Line 8312, "Forms.pas" + 3)
[00A7D7B1]{A.exe } ExceptionDlg.TfrmException.ExceptionHandler (Line 428, "..\Shared\ExceptionDlg.pas" + 2)
...
<snipped>
...
------------------------------------------------------------------------------
System : Windows XP Professional, Version: 5.1, Build: A28, "Service Pack 2"
Processor: Intel, Intel(R) Core(TM)2 Quad CPU Q6700 # 2.66GHz, 2666 MHz MMX 64 bits
Memory: 1043; free 196
Display : 1920X1200 pixels, 32 bpp
------------------------------------------------------------------------------
Active Controls hierarchy:
TcxCustomInnerTextEdit ""
TcxTextEdit ""
TcxGridSite ""
TcxGrid "cxgHeader"
TPanel "pnlMain"
TTabSheet "tshAccMov"
TPageControl "pcoMov"
TfrmMain "frmMain"
------------------------------------------------------------------------------
...well, imho, isn't worth to reinvent the wheel.
This has already been done and it's free. Download (if you haven't already) the JEDI's JVCL+JCL from SourceForge and install them. In File | New | Other | Delphi Files... you'll have a new item: 'Jcl Exception dialog for Delphi'.
And (imho) this is much more mature/advanced than you can do 'if you'll have time'. Also you can customize the generated Exception Handler to fit to your needs. There is also a support newsgroup for this. As an aside, IIRC, you need only the JCL for the dialog but I'm not sure. Also, you have also commercial options for this (madExcept, EurekaLog etc.) but these are only advanced Error Loggers while JVCL, besides that's free, will give you also over 600 components to play with.
HTH