Programmatically create content database in C# (SP 2013)

The goal is to have a web user interface with the option to create new site collections with new Content Database.

With the admin user I can manually in the CA create new Content Databases. I can also create a new site collection in this content database.

The idea was to create an event receiver (C#). If the user adds data to a table, the mentioned actions are to be executed.

Experiments: a) Console application – works!

using (SPSite site = new SPSite("http://sp2013")) {   using (SPWeb spWeb = site.OpenWeb()) {       SPWebApplication elevatedWebApp = spWeb.Site.WebApplication;         elevatedWebApp.ContentDatabases.Add("sp2013", "WSS_Content_80_" + DateTime.Now.ToString("yyyymmddhhMMss"), null, null, 10, 15, 0);     } } 

b) Event Receiver – Only create site collections works, creation of content databases does not work! Error: Access Denied.

c) Web Service – Does not work! Error: Access Denied.

So, why do I get the error Access Denied when I can create site collections, but only content databases creation not go?

Finally I executed PS Script – but this also doesn´t work.

# AUTHOR: Paul Kotlyar # CONTACT: unclepaul84@gmail.com # DESCRIPTION: sets an option on content web service that allows updating of SP Administration objects such as SPJobDefinition from content web applications function Set-RemoteAdministratorAccessDenied-False() {     # load sharepoint api libs     [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $  null     [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration") > $  null    # get content web service  $  contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService   # turn off remote administration security  $  contentService.RemoteAdministratorAccessDenied = $  false   # update the web service  $  contentService.Update() } 

Maybe somebody knows a solution?

MySQL Syntax error when trying to create database trigger

When Trying to create the below trigger, I am receiving a syntax error. It looks good to me and I’m having a terrible time trying to figure it out.

  DELIMITER $  $       CREATE TRIGGER trg_pic_hours     AFTER INSERT ON CREW     FOR EACH ROW     BEGIN     IF (NEW.CREW_JOB = 'Pilot') THEN     UPDATE PILOT     SET PIL_PIC_HRS = TEMP_PIL.PIL_PIC_HRS + CHARTER.CHAR_HOURS_FLOWN     WHERE CHARTER.CHAR_TRIP = NEW.CHAR_TRIP     AND PILOT.EMP_NUM = NEW.EMP_NUM;     ENDIF;     END$  $       DELIMITER;  ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; END' at line 10 

Is it normal that our sharepoint on-premises 2013 does not have WSS_Loging database

we have a sharepoint farm 2013 (license type = SharePoint Server with Standard Client Access License) , now we are facing an issue that the “Usage reports” for our sites will always be empty (0 views). so i login to out database server, to check the permission for the “WSS_UsageApplication”.. but i have noted that our database server miss the “WSS_Logging” database, here is our database list:-

enter image description here

so is this normal? and how i can check if this database server actually exists or have been removed? also if this database was removed, then can we still access and use our sites? as we did not face any issues, except for the “Usage Report” been empty…

but when i checked the logging database name inside our CA >> Monitoring >> ” Configure usage and health data collection” >> i found the name as follow “WSS_UsageApplication” and not “WSS_Logging”:- enter image description here

so am i missing anything? as on all the farms i worked on i always find a database named “WSS_Logging”

Deploying application on with 2 Front End Server and 2 Database servers which are clustered

I have following questions with regards to multiple servers in Farm configuration.

  1. I want to create a web application , will it be created across both the Web Front End Servers?
  2. If I want to restore a database through Sharepoint Management Shell with the Restore command, will it restore the database on both the clustered databases without me doing anything?

Do database actions inside a transaction become slower as the transaction grows?

I have a PostgreSQL database running a transaction. Inside that transaction I process around 160 records from an Excel file. As it runs, I see the processing becomes slower with each record (0.05 secs for the first to 0.20 for the last).

Could this be because of the transaction, or should I like elsewhere?

Should I create a User model for my Mongodb database even though I am using Okta for authorization? [on hold]

It seems like okta can be treated as a database for users. Should I use it to store all the information for each user, or should I just store the username, password, etc there and still create a user model in my mongo database?

How to implement a Daily Recap email of Database records modified the previous day sent to Subscribed Users like Basecamp does?

I am building a Project Management module for SugarCRM. It consists of a “Project” which has information on the project like Name, description, start and completion dates, creator name, status (open, in progress, cancelled, completed), priority (high, low, etc…), type (php, javascript, magento, sugarCRM, SEO, etc…).

A Project also has “Project Tasks” which a project can have as many Tasks as you want. A Project Task has many of the same DB fields as a Project does with some other features like sort order.

Lastly a Project has “Project Documents” which allow you to upload images, text files, any sort of file really related to the project.

On the Project database, I have a field called “subscribers” which is a text field and I store a comma separated list of User ID’s for user’s who are subscribed to updates/emails related to this project. So the subscriber field is on a Per Project basis. One user might be subscribed to Project 1 but not Project 2.

The reasoning behind this Subscriber database field on the Projects, is I would like to send out a daily email to all subscribed users showing Projects they are subscribed to that have been edited the day before. So if I am subscribed to “Project 1” and it’s database fields are modified, it has new documents added, or new tasks added, completed, or modified, then I would get an email the following morning showing all that data in a Daily Recap email.

My idea for this comes from using the popular Project Management app/service Basecamp which sends out a Daily Recap every morning of all projects and activity from the previous day that you are subscribed to.

I am looking for feedback on how to best implement this system. I have everything coded and working up to the subscription part where the user ID’s are saved to the Project database. So I basically will have a cron or similar that runs daily to send the emails to everyone that is subscribed.

I guess I am looking for the best approach to determine what projects and such should be in these emails. On my Project Tasks database, I have a modified datetime field so I can determine when the items were modified, same on the Projects table…

So I am thinking I can just query my 3 database tables and build a list based on items modified in the past day.

What Basecamp does, is instead of sending a separate email to the same user for each project they are subscribed to, they get 1 email. To do this, I would have to iterate over my user list instead of my project list. On each User, I would then have to query all the projects to find which projects that user is subscribed to, then run my queries on the appropriate projects. Keep in mind, I can’t simply store a list of projects each user is subscribed to on the user table as this is a module.

I am just hoping to get some feedback, ideas, suggestions on improvements to this idea or a better way or if what I have outlined sounds pretty good?


Conversion of numerics to/from database Real

I am writing data from MMA (11.0.1.0, Win 10 home 64 bit) to a Microsoft SQL Server/T-SQL database and am having considerable trouble controlling precision.

The target column in the database has data type real (as shown in SQLServer Management Studio) and reading back in MMA from SQLColumns[] as e.g.

SQLColumn[{“Data_Smoothed”, “Stats_Mean”}, “DataTypeName” -> “real”, “DataLength” -> 24, “Default” -> Null, “Nullable” -> 1]

I wish to use Real as it is only 4-bytes and has ample range for my purposes. Microsoft datatype documentation says the range of real is – 3.40E + 38 to -1.18E – 38, 0 to 1.18E – 38 to 3.40E + 38 but I cannot work out how to coerce precision suitably on output values to write so that they read back “correctly”.

How can I process numeric values for use in SQLUpdate so that the readback is exactly the value written to within a certain precision?