can't delete site columns that aren't referenced - sharepoint-2010

I just created a couple of site columns and content types that reference them through VS2010. I updated one of the fields and then tried to redeploy, but after retracting, deploy failed because the site columns previously created were still there. I tried to delete them manually from the UI, and got an alert box with this message:
Site columns which are included in content types cannot be deleted.
Remove all references to this site
column prior to deleting it.
I dug around in SharePoint Manager and didn't find any references, so I used powershell to enumerate all the content types and lists looking for references to my site columns and found nothing.
I tried to delete using PowerShell like this:
$web.Fields.Delete("StartTime")
which resulted in this error:
Exception calling "Delete" with "1" argument(s): "Site columns which are included in
content types or on lists cannot be deleted. Please remove all instances of this site
column prior to deleting it."
At line:1 char:19
+ $web.Fields.Delete <<<< ("StartTime")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Finally, a simple inspection of the columns in PowerShell shows the following:
Title Id CanBeDeleted ParentList Sealed ListsFieldUsedIn
----- -- ------------ ---------- ------ ----------------
Start Time OBE 6fa0d85b-9af1-408b-835f-d4c66536... True False {}
Time Tracker Tags 92bc866b-0415-45f0-b431-d4df69c4... True False {}
I'm experienced with MOSS 2007 and new to SP2010, but I've never seen this happen before. Anyone have any hints?

Your need to find and remove both the content types that use the site column and also any lists or libraries that use the site column you are trying to delete. Use PowerShell to get the site column object using something like this:
$column = $web.Fields[“Column Display Name”]
Then find all the places where it is used, using something like this:
$column.ListsFieldUsedIn()
which spits out two GUIDs -- the WebID and ListID -- of every place that uses this content type.
Below is a PowerShell script that loops over all the list GUIDs returned from ListFieldUsedIn() and then finds the subweb and list matching that GUID and prints out list name and subweb URL for each usage :
$site = Get-SPSite "http://sharepoint"
$rootweb = $site.rootweb
$siteColumnToRemove = "Column Display Name”
$sc = $rootweb.Fields[$siteColumnToRemove]
if ($sc)
{
write-host " Found Site Column '" $sc.Title "' in gallery" -ForegroundColor Gray
foreach( $listusage in $sc.ListsFieldUsedIn() )
{
$listID = $listusage.ListID
foreach ($subweb in $site.allwebs)
{
foreach ($list in $subweb.lists)
{
if ($list.ID -eq $listID)
{
write-host " Site Column '" $sc.Title "' used in list '" $list.Title "' in site '" $subweb.Url "'" -BackgroundColor Yellow -ForegroundColor Black
}
}
}
}
}

Happens to SharePoint 2010 too. Try looking at:
$field.AllowDeletion = $TRUE
$field.Update()
When I set that, seemed to work. Now I just can't replicate it, in order to prove my point. Typical.

I had this same problem and was able to delete using SharePoint Designer - not sure if anyone can validate this works for them.

It's been a while, and I've long since moved on from this problem, but I think that the final answer was that there were content types relying on a particular site column that weren't picked up by SPM.
I think once I retracted everything custom from the site, I was able to delete normally.

My guidance is that you should never delete a site column once it's in use. I've seen site collections become completely unusable because of issues trying to delete site columns or content types.
If you no longer need the site column, just hide it.

Related

Need to get issuelinks types with Jira python

I am writing a script with Jira python and I have encountered a big obstacle here.
I need to access to one of the issuelinks under "is duplicated by" but I don't have any idea about the attributes I can use.
I can get to the issuelinks field but I can't go further from here.
This is I've got so far:
issue = jira.issue(ISSUE_NUM) #this is the issue I am handling
link = issue.fields.issuelinks # I 've accessed to the issuelinks field
if hasattr(link, "inwardIssue"):
inwardIssue = link.inwardIssue
and I want to do this from here :
if(str(inwardIssue.type(?)) == "is duplicated by"):
inward Issues can be
is cloned by
is duplicated by
and so on.
how can I get the type of inward Issues??
There seem to be a few types of issue links. So far I've seen: Blocker, Cause, Duplicate and Reference.
In order to identify the type that the IssueLink is you can do the following:
issue = jira.issue(ISSUE_NUM)
all_issue_links = issue.fields.issuelinks
for link in all_issue_links:
if link.type.name == 'Duplicate':
inward_issue = link.inwardIssue
# Do something with link

Error: Not found: Dataset my-project-name:domain_public was not found in location US

I need to make a query for a dataset provided by a public project. I created my own project and added their dataset to my project. There is a table named: domain_public. When I make query to this table I get this error:
Query Failed
Error: Not found: Dataset my-project-name:domain_public was not found in location US
Job ID: my-project-name:US.bquijob_xxxx
I am from non-US country. What is the issue and how to fix it please?
EDIT 1:
I change the processing location to asia-northeast1 (I am based in Singapore) but the same error:
Error: Not found: Dataset censys-my-projectname:domain_public was not found in location asia-northeast1
Here is a view of my project and the public project censys-io:
Please advise.
EDIT 2:
The query I used to type is based on censys tutorial is:
#standardsql
SELECT domain, alexa_rank
FROM domain_public.current
WHERE p443.https.tls.cipher_suite = 'some_cipher_suite_goes_here';
When I changed the FROM clause to:
FROM `censys-io.domain_public.current`
And the last line to:
WHERE p443.https.tls.cipher_suite.name = 'some_cipher_suite_goes_here';
It worked. Shall I understand that I should always include the projectname.dataset.table (if I'm using the correct terms) and point the typo the Censys? Or is this special case to this project for some reason?
BigQuery can't find your data
How to fix it
Make sure your FROM location contains 3 parts
A project (e.g. bigquery-public-data)
A database (e.g. hacker_news)
A table (e.g. stories)
Like so
`bigquery-public-data.hacker_news.stories`
*note the backticks
Examples
Wrong
SELECT *
FROM `stories`
Wrong
SELECT *
FROM `hacker_news.stories`
Correct
SELECT *
FROM `bigquery-public-data.hacker_news.stories`
In Web UI - click Show Options button and than select your location for "Processing Location"!
Specify the location in which the query will execute. Queries that run in a specific location may only reference data in that location. For data in US/EU, you may choose Unspecified to run the query in the location where the data resides. For data in other locations, you must specify the query location explicitly.
Update
As it stated above - Queries that run in a specific location may only reference data in that location
Assuming that censys-io.domain_public dataset has its data in US - you need to specify US for Processing Location
The problem turned out to be due to wrong table name in the FROM clause.
The right FROM clause should be:
FROM `censys-io.domain_public.current`
While I was typing:
FROM domain_public.current
So the project name is required in the FROM and `` are required because of - in the project name.
Make sure your FROM location contains 3 parts as #stevec mentioned
A project (e.g. bigquery-public-data)
A database (e.g. hacker_news)
A table (e.g. stories)
But in my case, I was using the LegacySql within the Google script editor, so in that case you need to state that to false, for example:
var projectId = 'xxxxxxx';
var request = {
query: 'select * from project.database.table',
useLegacySql: false
};
var queryResults = BigQuery.Jobs.query(request, projectId);
check exact case [upper or lower] and spelling of table or view name.
copy it from table definition and your problem will be solved.
i was using FPL009_Year_Categorization instead of FPL009_Year_categorization
using c as C and getting the error "not found in location asia-south1"
I copied with exact case and problem is resolved.
On your Big Query console, go to the Data Explorer on the left pane, click the small three dots, then select query option from the list. This step confirms you choose the correct project and dataset. Then you can edit the query on the query pane on the right.
may be dataset name changed in create dataset option. it should be US or default location
enter image description here

Volusion's generic SQL folder, functionality

I found this response very helpful
How to write join query in Volusion API
What I'm looking for is a way to add my own .SQL and .XSD files to the /vspfiles/schema/Generic folder and be able to pass parameters to it. Does anyone know if that's possible.
A very basic example of the SQL would be something like this...
select * from Orders where order_id = "-ORDERID-"
...and I'd be able to pass in the "-ORDERID-" as a variable.
Or even better the SQL file would just be this "-SQL-" and I could pass in the entire SQL string myself. Thanks!
Thanks user357034 for getting me here (I'd "up" your answer but I'm new and don't have any reputation). I wanted to post the code I used in case others run into this. And also get any feedback if you see anything that looks goofy here.
First, I created an ASP file like so
Dim orderid
Dim status
orderid = Request.QueryString("orderid")
status = Request.QueryString("status")
sql = " update Orders " & _
" set OrderStatus = '" + status + "' " & _
" where Orderid in (" + orderid + ") " ;
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.OpenTextFile(Server.MapPath("./MY_FILE.sql"),2,true)
f.WriteLine(sql)
f.Close
set f=Nothing
set fs=Nothing
I FTPed that up to the "generic" folder on Volusion.
Next, in PHP, I call this file, similar to this...
$asp = file("http://MY_SITE/v/vspfiles/schema/generic/MY_FILE.asp?
orderid=11,12&status=Processing");
foreach ( $asp as $line )
{
echo ($line);
}
NOTE: I already FTPed an XSD file to the same folder with the same name, like MY_FILE.xsd.
And finally, I make a web service call to my service, like this...
$url = "http://MY_SITE/net/WebService.aspx?
Login=XXXX&EncryptedPassword=YYYYY&API_Name=Generic\MY_FILE"
Works great. I go into the Volusion admin site, look at the Orders 11 and 12, and they were updated. I'm using this method for several areas in Volusion where their API is lacking. Thanks!
While technically one could pass in text comprised of a complete SQL query, however I would strongly caution against such practice as it would open up your site to malicious activity and/or possible security issues. I would limit the scope to a specific query and only allow one or more parameters to be used.
To accomplish this you have to create an custom ASP page in Volusion that would gather the parameters from the user, in your case "order id" and then insert them into the set SQL query, write that SQL query as a text file to the server in the correct location as shown in https://stackoverflow.com/a/29134928/357034 and then execute the query. All this is done in the custom ASP page.
UPDATE: If you just want a simple order id query with all fields returned you don't even have to use the the SQL method as Volusion already has a built in method to return this data. You just have to use a custom ASP page to insert the order id parameter and then execute the URL with the parameter attached. In your ASP page you would insert the order id in place of the xxxxx
http://www.yoursiteurl.com/net/WebService.aspx?Login=name#yoursiteurl.com&EncryptedPassword=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxC&EDI_Name=Generic\Orders&SELECT_Columns=*&WHERE_Column=o.OrderID&WHERE_Value=xxxxx

Rally Excel Plugin Queries

I am working with the Rally/Excel plug-in and setting up queries/filters for our various delivery teams. One of the teams is named "Agency / L&C". The & is causing me all sorts of problems that I cannot seem to get past. The current filter is:
((Release.Name = "2013 November") AND (Project.Name = "Agency / L&C"))
When I execute the query I get this error:
Query failed due to errors:
Could not parse: Cannot parse expression "((Release.Name = "2013 November") AND (Project.Name = "Agency / L" as a query
I have tried several things, ' before and after, '' before and after, %, " and \ and nothing seems to be making it register the & as text.
Thanks for the help
This is an educated guess but I would think the problem arises from the ampersand not being escaped before the request is made to the to the API. You might try changing it to "%26" (the HTML code for "&") and see what you get.

Indexing Service empty filename property

I'm using the Windows Indexing Service for the first time and I need to return the doctitle and filename from the query.
My query is;
select doctitle, filename, vpath, rank, characterization from scope() where FREETEXT(Contents, '" & searchText & "') order by rank desc
I setup a fairly basic catalogue just pointing to a folder. I'm using this code from a website, the files are on the local machine and authentication shouldn't be a problem.
My search returns results but nothing in the filename property. The doctitle is populated but nothing else.
Thanks,
Mike
I know it's been a few months since this has been answered, but I'm currently using WIS on Windows Server 2008 R2 using C# and came across this on a search. Sometimes I can't take no for an answer, so I had scoured the internet and came up with this solution.
I'm sure you can convert the code as necessary, but...
You'll have to install the Windows Server 2003 File Services Indexing Service from the Server Manager's Roles.
For the catalog properties, I disabled the Inheritable Settings and set the WWW Server appropriately. I also generated 250 character abstracts to be stored in the Characterization column.
When I set up my catalog, I included/excluded certain folders of my web site's directory (include the site root) and when I queried it, I used the below SQL statement:
EDIT: Note the use of FREETEXT(Filename, '\""+q+"\"')) to query the name of the file
String fileTypes = "\".aspx\" OR \".doc*\" OR \".xls*\" OR \".ppt*\" OR \".txt\" OR \".pdf\" OR \".rtf\"";
String q = query.Text.Replace("'", "''");
sSqlString = "SELECT Filename, DocTitle, Size, VPath, Path, Rank, Write, Contents, Characterization ";
sSqlString += "FROM SCOPE() ";
sSqlString += "WHERE (CONTAINS(Contents, '\""+q+"\"') ";
sSqlString += "OR FREETEXT(Filename, '\""+q+"\"')) ";
sSqlString += "AND CONTAINS(Filename, '"+fileTypes+"') ";
sSqlString += "ORDER BY rank DESC, write DESC";
I create my connection using the using statement:
using(OleDbConnection conn = new OleDbConnection("Provider=MSIDXS.1;Data Source='"+catalog+"'"))
{
//your connection and data collection code here
}
One of the issues that I have run into is with certain filetypes. If the document creator didn't include a document title in their MS Office product, you won't get the DocTitle. If the pdf doesn't have any recognizable text in it and the document properties are not filled out, the docTitle and Content will be empty. The way I look at it, is if the business doesn't make their files 508 compliant, they won't show up in the results properly.
Here's a quick snippet of the ListView template that I am using.
<ItemTemplate>
<h3><%# Eval("DocTitle").ToString().Trim() == "" ? Eval("Filename").ToString().Split('.')[0] : ProperCase(Eval("DocTitle").ToString()) %></h3>
<p><span style="color:#0083be;">
<%# Request.ServerVariables["HTTP_HOST"].Length+vFilePath(Eval("Path")).Length > 100 ? (Request.ServerVariables["HTTP_HOST"]+vFilePath(Eval("Path"))).Substring(0,100)+"..." : Request.ServerVariables["HTTP_HOST"]+vFilePath(Eval("Path")) %></span><br />
<span style="color:#4d4e53"><%# String.Format("{0:MMMM dd, yyyy}",Eval("Write")) %> - </span>
<%# Eval("Characterization").ToString().Trim() == "" ? "..." : Eval("Characterization").ToString().Length == 250 ?
Eval("Characterization").ToString().Substring(0,250)+"..." : Eval("Characterization")%>
</p>
</ItemTemplate>
Since the docTitle in my case is used for the results header, I figured that if it's empty, I can take that empty string and replace it with the filename, minus the extention.
When making the query, make sure that you also properly use your meta tags using the keywords and description. This and the static content on the .aspx pages does get read by WIS. You'll note my use of Characterization to retrieve the contents.
This link provides instructions on setting up the W2k8 WIS along with vb.net code.
This link is a good source for the multitude of properties that can be queried and/or displayed.
I found the answer in this article;
http://support.microsoft.com/kb/954822
You cannot index Internet Information Services (IIS) Web sites in
Windows Server 2008 because of the design changes that were made to
IIS 7.0.
The successor or the Indexing Service is Windows Search.
Windows Search Wiki
Looks like I'm going to have to change the site to use Windows Search.