Create Sub Site on SharePoint by using Power Automate - sharepoint

Could you please help me with an advise?
I tried using two methods to create a subsite into a SharePoint Site.
For example, I tried to create subsite Account2 into the site TestAccounts.
#1. The first method is:
Power Automate Flow of Method1
The output of the first method is:
Output of Method 1
As you can see, the Power Automate flow runs for a long period of time and it gives an warning with the status 'BadGateway'. I am not sure why.
#2. The second method is: Power Automate Method 2
The output is: Output Method2
This time it runs successfully, but it gives an SiteStatus = 3 which means "3 - Error. An error occurred while provisioning the site." according to this site: https://learn.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest. In other words, it runs, but it does not create the subsite for some reason.
I used this document for both of the methods, but neither of them did not create the subsite into the main site.
Do you have any idea how I could successfully create a subsite? Thank you.

Related

Cannot take Content Type Name in SP List with Power Automate

i am basically trying to get "Content Type Name" to another column with "When an item created" flow of Power Automate. but somehow it's not working?
is there any idea?
I feel that there is nothing wrong with your flow, and I have created and run it successfully. You could look at flow run history and check whether the Azim column was successfully assigned during this run.
Here are some screenshots of the success and the output of the process:
list1 run history Flow OUTPUTS

SharePoint Online and prevent users from editing old list items after specific time

We have SharePoint Online site with list. Users can add, edit and delete own items in this list.
How I can resolve new issue - Users can't edit and delete own items older than one week (from creation date).
Is it possible without coding Remote Event Reciever or Azure function?
Per my knowledge, there is not an OOTB way to achieve it, we have to write some custom code.
If you only want to the user can't see some items in list view base on some condition, we can use list view Filter to achieve it. Note:User also access item form through URL.
I suggest you use remote event receiver or azure function to achieve this requirement.
In classic site, we can also add some JavaScript code into master page to prevent users access edit form page and hide the delete button in the page.
For this kind of requirement the solution which is 'no code' and with SP online is Power automate (previously MS Flow).
The best option in Your case would be to create a recurring flow which for example starts every day at 00:10 AM -> please see MS docs with description how to do this.
The Flow should get all items from a specific list for a specific site. You can do that with the 'Get Items' step. After that You can use the 'Apply to each' Step to check each item creation date with a 'Condition' Step. When some item will be older than one week You can use additional steps to break permission inheritance on item and remove all groups from permissions on this item or change the permissions on item from edit to read. Here I found an interesting article where are some predefined steps shown how to remove all permissions, remove and add a group. To tell You the truth I was not aware there already are this kind of steps in Power automate (maybe something new :) ) .
I would use SharePoint HTTP request and use SharePoint API to remove permissions on item and change some group role from edit to read. So I would do a similar procedure like here the only difference is not to break permission on all list but just on a specific item which I would get by ID. You can do all of those API request with a 'SharePoint HTTP request' Step
Please be aware there usually is a 5 000 unique permission levels threshold (50 000 is in on-prem) in list (place check here for latest info on limits in SP Online). So a better option would be to create a folder with view only permissions for the users before and when an item is older than one week You could only move this item to that folder also with Power Automate. That way all the files (items) in this folder would be read only and You would have only one unique item scope in this list and not as many as the old items.
Some other options You could use are:
Also code solution, but not RER and Azure function, would be to create a console app that uses CSOM to look through items in this list and either breaks permission on each item or moves to a folder (like the flow) and schedule this CSOM app on some local or remote server in Task Scheduler... Of Course You would need some local (or other) server for it which is always up and running :)
If You would like to use some 'little coding' and by any chance You are still using classic UI (not modern) You could use JSLink attached to CT or some column like Title and block editing of fields in edit forms etc (this is not the best option as always the users may create a view without a columns with this JSLink and go around this or modify the item using CSOM or Rest API)
You might consider using PowerApps (In case you have it configured in your subscription) to customize the edit form,
Then you use the validate() method, and disable a user from submitting the form in case ("Created" + 7 days) <= Today() or something like that.

excel web query properties from drop-down online

I am trying to retrieve data from http://www.professorpaddle.com/rivers/riverlist.asp which automatically defaults to Washington state as the state id. However, I want to pull data from the table for Oregon. Can this be done as a property? So far I've tried writing a .iqy file with the following and it still doesn't work:
WEB
1
http://www.professorpaddle.com/rivers/riverlist.asp?hstateid=["oregon"]
Selection=EntirePage
Formatting=All
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
I am new to VBA but open to using it as well.
You've got two issues:
The page you linked uses a POST not a GET request so you have to write the parameters separately, not as part of the URL.
I'm not sure why you're supplying oregon as the hstateid. When examining the request in Chrome's dev tools I see 37 as the value of this parameter.
And the brackets around the value indicate that you want you to specify variable values for the parameter but I think you're trying to just have a static value here.
So your query should start with something like:
WEB
1
http://www.professorpaddle.com/rivers/riverlist.asp
hstateid=37

Sharepoint Designer 2013: Workflow stops when current item is a Lookup Field

Objective: Create a Workflow that Rename a Document in the Library.
My Document Library is in a sub site, is a child. This library have two lookup columns, and they refer to a list in the main site, the parent. That is, a library that have lookup field a list in other site. These lookup field, I will use to rename a file.
Problem: in my worflow every action that use [%CurrentItem:LookupField%], it does not follow. The workflow stops. Fail.
I can't understand the origin of that error.
Any information will be helpfull.
Workaround: Use REST CALL as you can see in the know issue. http://office.microsoft.com/en-us/help/sharepoint-server-2013-known-issues-HA102919021.aspx?ss-src=featuredhelp&ss=3f1a5755-0dad-4a34-8758-904329f5e4c9
It's a know issue, as you can see in the o365 forum.
community.office365.com/en-us/f/154/p/206482/754001.aspx
Know issues of SPD 2013:http://office.microsoft.com/en-us/help/sharepoint-server-2013-known-issues-HA102919021.aspx?ss-src=featuredhelp&ss=3f1a5755-0dad-4a34-8758-904329f5e4c9
Workaround: Use Rest Call Action.
I need the title, that is in my lookup field, but my workflow cant get this information. No if this lookup field is looking for a list in other level site.
So I will use REST CALL to my library, and get THE ID of my lookup field, and then i will do other REST CALL to that list, using the ID, and it will return my title of this item. :D
Looks easy #_# but i am not sure how to do a rest call from the workflow D:
I failed #_#... Now when I have to request something in other list, i got "Unauthorized"... really? D:
FINAL SOLUTION: We did it... You have to set app permissions for your workflow. you Can see how do it here: http://msdn.microsoft.com/en-us/library/office/jj822159(v=office.15).aspx
Don't forget: If you want to access a list in a TOP level site (main), you have to set this permission there, in the top level site. Why i am saying it? because, I set this permission on the same site where my workflow started, so when it wanted to request something in the main site, my request fail. So pay atection when do it. :)
If you have problems, count with me. \o/

Automatically copy data from SP2010 external list to an SP2010 custom list

I have an SP 2010 external list that is populated with customer names. The list is updated occasionally throughout the day. I would like to automatically copy the newly added names to another SP 2010 list when it is updated or at a set time (hourly).
Is there an easy way to do this? And if not, is there at least a way to do it?
Thank you for your help.
Unfortunately, External Lists do not support workflows. So workflow is not a solution here.
One of the way to do this would be to create a custom timer job to synchronize items & configure to run it periodically. See details about how to create & register custom job here.
But this approach has it's own drawbacks:
it is complex enough
you will need a farm scoped feature +
receiver to register the job. The
reason is that for security purposes
you can't register a custom job from
within the code running in Content
Web application (so it will not work
in site collection level feature
receiver), only from code running in
Central Admin app.
I'd build a windows service or a timed job in SharePoint and then hook up a compatible ado.net connector to my process. This way you can copy or synchronize data between your two lists as if they where ordinary SQL tables.
private void example()
{
// Fetch data from your left sharepoint
SharePointConnection leftConnection = new SharePointConnection(#"
Server=mysharepointserver.com;
Database=mysite/subsite
User=spuser;
Password=******;
Authentication=Ntlm;
TimeOut=10;
StrictMode=True;
RecursiveMode=RecursiveAll;
DefaultLimit=1000;
CacheTimeout=5");
leftConnection.Open();
string leftQuery = "SELECT * FROM LeftList";
SharePointDataAdapter adapter = new SharePointDataAdapter(leftQuery, leftConnection);
DataTable dt = new DataTable();
adapter.Fill(dt);
// Insert data in right sharepoint
SharePointConnection rightConnection = new SharePointConnection(#"
Server=anothersharepointserver.com;
Database=whateversite
User=spuser;
Password=******;
Authentication=Ntlm;
TimeOut=10;
StrictMode=True;
RecursiveMode=RecursiveAll;
DefaultLimit=1000;
CacheTimeout=5");
rightConnection.Open();
// build your rightQuery here
string rightQuery = "Insert into"...
SharePointCommand command = new SharePointCommand(rightQuery, rightConnection);
command.ExecuteNonQuery();
}
You could try this one http://www.bendsoft.com/net-sharepoint-connector/. This ado.net connector uses the API of SharePoint so you can run the service in a third machine and as long as it has access you'll be fine.
There are some examples and howto's at http://blog.bendsoft.com
A workflow can be created for this easily. The workflow can be triggered when an item is newly created or updated. The workflow can create the same item into another list.
Try creating the workflow using SharePoint designer, which is quiet straight forward.
Hope this helps. :)
Why do you want to copy the external data to another list? What is the purpose of doing this? Perhaps there is a better solution for what you are trying to do.
The reason I say this, is because you are going to be replicating data and could get a bit tricky, especially if you allow the data to be updated in both places.
I'd use MS access in order to copy data out of one table, and push it into another table. I've used Access/Sharepoint extensively, and it's a little bit buggy.. but it generally works. It might crash- but for 90% of small tables, heck yes you can do this!

Resources