Karim's profileMicrosoft Dynamics CRM B...PhotosBlogListsMore Tools Help

Blog


    June 17

    SpSecurity.RunWithElevatedPrivileges() method Fails!!

    Hello everybody,

    I'm trying to create a site programmaticaly under the sharepoint portal by
    using the following code and it generates the following error :

    Microsoft.SharePoint.SPException was unhandled by user code
      Message="Updates are currently disallowed on GET requests.  To allow
    updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb."
      Source="Microsoft.SharePoint"
      ErrorCode=-2130243945
      StackTrace:
           at Microsoft.SharePoint.Library.SPRequest.CreateWeb(String bstrUrl,
    String bstrTitle, String bstrDescription, UInt32 nLCID, String
    bstrWebTemplate, Boolean bCreateUniqueWeb, Boolean bConvertIfThere, Guid&
    pgWebId, Guid& pgRootFolderId, Boolean bCreateSystemCatalogs)
           at Microsoft.SharePoint.SPSite.CreateWeb(String strUrl, String
    strTitle, String strDescription, UInt32 nLCID, String strWebTemplate,
    Boolean bCreateUniqueSubweb, Boolean bConvertIfThere, Guid webId, Guid
    rootFolderId, Boolean createSystemCatalogs)
           at
    Microsoft.SharePoint.SPSite.SPWebCollectionProvider.CreateWeb(String
    strWebUrl, String strTitle, String strDescription, UInt32 nLCID, String
    strWebTemplate, Boolean bCreateUniqueSubweb, Boolean bConvertIfThere)
           at Microsoft.SharePoint.SPWebCollection.Add(String strWebUrl, String
    strTitle, String strDescription, UInt32 nLCID, String strWebTemplate,
    Boolean useUniquePermissions, Boolean bConvertIfThere)
           at _Default.<>c__DisplayClass1.<Page_Load>b__0() in c:\Microsoft
    Dynamics CRM CTP\RunwithelevSecurity\Default.aspx.cs:line 35
           at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object
    state)
           at
    Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
           at
    Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated
    secureCode)

    =====================================================================

    Here is my Code :


            SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
            globalAdmin.AllowUnsafeUpdates = true;
            Context.Items[SPGlobalAdmin.RequestFromAdminPort] = true;
            Page.RegisterHiddenField("__REQUESTDIGEST",
    globalAdmin.AdminFormDigest);

            SPSite elevatedSite = null;
            SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    //Access the root site collection

                    using (elevatedSite = new
    SPSite("http://localhost:1900/sites/Projects"))
                    {

                        SPWebCollection sites = elevatedSite.AllWebs;
                        elevatedSite.AllowUnsafeUpdates = true;

                        //Create the new Web

                        using (SPWeb web = sites.Add("Project_Name",
    "Project_Title", "Project_Description", 1033, "STS#0", false, false))
                        {
                            web.AllowUnsafeUpdates = true;
                            Response.Redirect(web.Url.ToString());
                        }

                    }
                });

    Any help , I've searched many times, without any solution , the same error
    every time ??

    Regards,

    Karim

    June 14

    SQL Server 2008 KatMai - Your Data, Any Place, Any Time

    It was the first time anyone hear about the SQL Server KatMai in the first Microsoft BI Conference held in Washington DC the last month, I've attend a live webcast by David Campell
     
     
    I've installed the Katmai and tested some features in it , overall it's a very nice product and have a lot of enhancements than SQL Server 2005, but I've dissappointed in the enhancements of SSIS , they are not much , only one thing has been announced the "Data Capture Engine " which capture the data of insert , update , delete statments in the run time and change them, I've attended a Live chat on the Katmai couple a days ago and I've asked the experts If there is any major enhancements else in the SSIS and they generously ignored my questions.
    Anyway, Microsoft has added major enhancements on the Reporting Services 2008 like the following :
    • scalability and performance
    •  a server independent of IIS
    •  support for new report structures (some significant enhancements/changes to RDL)
    •  integrating Dundas and SoftArtisans technology.
    • Reporting Services SharePoint integration to store, secure, access, and manage reports, data sources, and resources from a SharePoint site.
    • Microsoft .NET Framework Data Provider for Hyperion Essbase to access Hyperion System 9.3 BI+ Enterprise Analytics data sources.
    • Report model generation from Oracle data sources that run on version 9.2.0.3 or later is supported.
    • Samples are now available online and are not installed via Setup.
    • Side-by-Side Installation of SQL Server "Katmai" Reporting Services and SQL Server 2005 Reporting Services (SSRS).

    and they are also reviewing the support of some of Dundas controls.

    Also there is major enhancements in the Analaysis services Data Mining and Multidimensional data.

    one of the cool features really in Katmai , is the location datatype and intelligent and spatial data type and I'll take about those two later and I'll accompany the blog with some code.

    Another nice feature also is the duplicate detection which detect the duplication in data when you import the data from a place to another.

    Of course there is major enhancements in the performance of the Data warehousing and the data auditing feature and a lot of other features that I'll explain in later posts.

    If there is anyone intrested in downloading the sql server he can access connect.microsoft.com website for participating in the testing program.

    Enjoy!!